home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / c / library / dos / grafik / mgl11 / doc / mgraph.txt
Encoding:
Text File  |  1993-12-30  |  259.8 KB  |  7,963 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.                                                          C H A P T E R
  11.                                                                      1
  12.  
  13.                                                           Introduction
  14.  
  15.             The MegaGraph Graphics Library (MGL) is a full featured
  16.             graphics library for displaying high performance graphics
  17.             on personal computers. It provides fast, low level 2D
  18.             drawing primitives that can be used to implement video
  19.             games, user interface software and even real-time 3D
  20.             animation. It will work in any video mode that has 16 or
  21.             more colors, including the new HiColor and TrueColor
  22.             modes available on PC's.
  23.  
  24.             The MGL is aimed at the experienced programmer, so no
  25.             tutorial documentation or information on generally using
  26.             libraries to write and successfully compile programs is
  27.             given. For more information you will need to consult the
  28.             documentation that came with your compiler.
  29.  
  30.             This document does not provide any information on
  31.             graphics programming concepts, or general programming
  32.             information about the MGL. Consult the MGL Programmers
  33.             Guide for this information.
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.             Chapter 1 - Introduction                                   1
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.             2                       MegaGraph Graphics Library Reference
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.                                                          C H A P T E R
  145.                                                                      2
  146.  
  147.                                            About the Library Reference
  148.  
  149.             The following chapters provide a detailed reference to
  150.             the routines in the MGL. All of the routines in the MGL
  151.             are grouped in alphabetical order within this chapter.
  152.             There is an individual entry for every function in the
  153.             library. If you wanted to know what the MGL_lineCoord()
  154.             function does, you would look it up in the library
  155.             reference where you would find an entry that:
  156.  
  157.                  Summarises what MGL_lineCoord does
  158.  
  159.                  Gives the syntax for calling the MGL_lineCoord
  160.                  routine
  161.  
  162.                  Tells you which header file(s) contain the prototype
  163.                  for MGL_lineCoord
  164.  
  165.                  Gives a detailed description of how MGL_lineCoord
  166.                  is implemented and how it relates to other line
  167.                  drawing routines.
  168.  
  169.                  Makes a reference to other related library routines
  170.  
  171.             The following sample library entry explains how to find
  172.             out such details about the routines in the MGL.
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.             Chapter 6 - Console Library                                3
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.             How to use reference entries
  209.  
  210.             Function    Summary of what the function does
  211.  
  212.             Syntax      function(modifier parameter[, ... ]);
  213.  
  214.                         This gives you the declaration syntax for the
  215.                         function. The [, ... ] indicates that other
  216.                         parameters and modifiers may follow.
  217.  
  218.             Prototype   header.h
  219.             in
  220.                         This lists the header file(s) containing the
  221.                         prototype for the function. The prototype of
  222.                         a function may be contained in more than one
  223.                         header file, in which case all the files
  224.                         would be listed, so use whichever one is more
  225.                         appropriate.
  226.  
  227.             Parameters  Briefly describes each of the function
  228.                         parameters.
  229.  
  230.             Remarks     This section describes what the function
  231.                         does, the parameters it takes and any details
  232.                         that you might need to know in order to get
  233.                         full use out of the function.
  234.  
  235.             Return      This section describes the value returned by
  236.             value       the function (if any).
  237.  
  238.             See also    This sections gives a list of other related
  239.                         functions in the library that may be of
  240.                         interest.
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.             4                       MegaGraph Graphics Library Reference
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.             MGL_availableFont
  276.  
  277.             Function    Determines if a specific font file is
  278.                         available for use.
  279.  
  280.             Syntax      bool MGL_availableFont(const char *fontname);
  281.  
  282.             Prototype   mgraph.h
  283.             in
  284.  
  285.             Parameters  fontname - Relative filename of the required
  286.                         font file
  287.  
  288.             Remarks     MGL_availableFont() is used to determine if a
  289.                         particular font file exists and is available
  290.                         for use. It will check first in the directory
  291.                         where the MGL driver files were located, and
  292.                         then in the current directory. If the font
  293.                         file is found it will return true, otherwise
  294.                         it will return false.
  295.  
  296.             Return      True if font file is available, false if not.
  297.             value
  298.  
  299.             See also    MGL_loadFont()
  300.  
  301.  
  302.             MGL_availableModes
  303.  
  304.             Function    Returns a list of all available video modes.
  305.  
  306.             Syntax      int * MGL_availableModes(int driver);
  307.  
  308.             Prototype   mgraph.h
  309.             in
  310.  
  311.             Parameters  driver - Detected video device driver ID.
  312.  
  313.             Remarks     MGL_availableModes() will return a list of
  314.                         all the currently available video modes given
  315.                         a specific video device driver ID. The value
  316.                         for the video device driver ID should be
  317.                         obtained via the MGL_detectGraph or MGL_init
  318.                         routines prior to calling this function.
  319.  
  320.                         You may call this routine before MGL_init()
  321.                         is called to determine what video modes are
  322.                         available before actually initialising a
  323.                         particular video mode. You must ensure
  324.                         however that the MGL_detectGraph() routine is
  325.                         called before you call the
  326.                         MGL_availableModes() routine.
  327.  
  328.                         The list of available video modes is returned
  329.                         as a table of integer values. The table is
  330.                         terminate with a -1.
  331.  
  332.  
  333.  
  334.  
  335.             Chapter 6 - Console Library                                5
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.             Return      Pointer to list of available video modes
  343.             value
  344.  
  345.             See also    MGL_detectGraph(), MGL_init(),
  346.                         MGL_availablePages()
  347.  
  348.  
  349.             MGL_availablePages
  350.  
  351.             Function    Determine the number of available video pages
  352.                         for a specific video mode.
  353.  
  354.             Syntax      int MGL_availablePages(int driver,int mode);
  355.  
  356.             Prototype   mgraph.h
  357.             in
  358.  
  359.             Parameters  driver - Detected video device driver ID.
  360.                         mode - MGL mode number to query.
  361.  
  362.             Remarks     MGL_availablePages() will return the number
  363.                         of pages of pysical video memory available
  364.                         for a specific MGL video mode and video
  365.                         device driver. The value for the video device
  366.                         driver ID should be obtained via the
  367.                         MGL_detectGraph() or MGL_init() routines
  368.                         prior to calling this function.
  369.  
  370.                         You may call this routine before the MGL_init
  371.                         routine is used to intialise a particular
  372.                         video modes. Thus you can filter out support
  373.                         for modes that do not have the require number
  374.                         of hardware video pages available for use.
  375.  
  376.             Return      Number of available video pages for mode, -1
  377.             value       on error.
  378.  
  379.             See also    MGL_detectGraph(), MGL_init(),
  380.                         MGL_availableMode()
  381.  
  382.  
  383.             MGL_beginDrawing
  384.  
  385.             Function    Setup for high performance drawing operation.
  386.  
  387.             Syntax      void MGL_beginDrawing(void);
  388.  
  389.             Prototype   mgraph.h
  390.             in
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.             6                       MegaGraph Graphics Library Reference
  403.  
  404.  
  405.  
  406.  
  407.  
  408.  
  409.             Remarks     MGL_beginDrawing() must be called before
  410.                         calling any of the special high performance
  411.                         drawing routines, such as the MGL_lineFast()
  412.                         and associated routines. MGL_beginDrawing
  413.                         will put the video hardware into a state that
  414.                         can be used to render the primitives much
  415.                         faster than otherwise possible.
  416.  
  417.                         All high performance drawing primitives end
  418.                         the word 'Fast', and must be bracketed
  419.                         between calls to MGL_beginDrawing() and
  420.                         MGL_endDrawing(). You may mix and match any
  421.                         of the fast drawing routines and normal
  422.                         library functions within an
  423.                         MGL_beginDrawing() and MG_endDrawing() block.
  424.                         You can also nest calls to MGL_beginDrawing()
  425.                         and MGL_endDrawing() (hence you can write
  426.                         your own functions that use the fast
  427.                         rendering routines but do not require the
  428.                         user to call MGL_beginDrawing() before
  429.                         calling your routine).
  430.  
  431.                             must
  432.                         You      ensure that you call the
  433.                         MGL_endDrawing() routine after drawing a set
  434.                         of high performance primitives.
  435.  
  436.             See also    MGL_endDrawing(), MGL_*fast()
  437.  
  438.  
  439.             MGL_beginGouraud
  440.  
  441.             Function    Setup for Gouraud Shaded drawing operation.
  442.  
  443.             Syntax      void MGL_beginGouraud(void);
  444.  
  445.             Prototype   mgraph.h
  446.             in
  447.  
  448.             Remarks     MGL_beginGouraud() must be called before any
  449.                         of the gouraud shading routines are called,
  450.                         such as the MGL_fillGouraudPolygon() routine.
  451.                         This will put the video hardware into a
  452.                         special mode for doing high peformance
  453.                         gouraud shaded rendering.
  454.  
  455.                         You should not call any other routines except
  456.                         the gouraud shading routines between calls to
  457.                         MGL_beginGouraud() and MGL_endGouraud(), and
  458.                         you should not nest calls to this routine.
  459.  
  460.             See also    MGL_endGouraud()
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.             Chapter 6 - Console Library                                7
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477.             MGL_beginPixel
  478.  
  479.             Function    Setup for high speed pixel drawing.
  480.  
  481.             Syntax      void MGL_beginPixel(void);
  482.  
  483.             Prototype   mgraph.h
  484.             in
  485.  
  486.             Remarks     MGL_beginPixel() sets up the video hardware
  487.                         for plotting single pixels as fast a
  488.                         possible. You must call this routine before
  489.                         calling any of the MGL_*Pixel() routines to
  490.                         ensure correct operation, and you must call
  491.                         the MGL_endPixel() routine after you have
  492.                         finished.
  493.  
  494.                         This routine is intended primarily to ensure
  495.                         fast operation if you intend to plot more
  496.                         than a single pixel at a time, so it will be
  497.                         done as fast as possible.
  498.  
  499.             See also    MGL_endPixel()
  500.  
  501.  
  502.             MGL_charWidth
  503.  
  504.             Function    Returns the width of a character in pixels.
  505.  
  506.             Syntax      int MGL_charWidth(char ch);
  507.  
  508.             Prototype   mgraph.h
  509.             in
  510.  
  511.             Parameters  ch - Character to measure.
  512.  
  513.             Remarks     MGL_charWidth() will return the width of the
  514.                         specified character, given the currently
  515.                         active font and attribute settings.
  516.  
  517.             Return      Width of the character in pixels (will depend
  518.             value       on currently active font)
  519.  
  520.             See also    MGL_textWidth(), MGL_useFont()
  521.  
  522.  
  523.             MGL_clearDevice
  524.  
  525.             Function    Clears the currently active display page on
  526.                         the active device..
  527.  
  528.             Syntax      void MGL_clearDevice(void);
  529.  
  530.             Prototype   mgraph.h
  531.             in
  532.  
  533.  
  534.  
  535.  
  536.  
  537.             8                       MegaGraph Graphics Library Reference
  538.  
  539.  
  540.  
  541.  
  542.  
  543.  
  544.             Remarks     MGL_clearDevice() will clear the entire
  545.                         currently active display page in the current
  546.                         background color. This is the fastest way to
  547.                         clear an entire display page, but if you wish
  548.                         to only clear a portion of the page, use the
  549.                         MGL_clearViewport() routine instead.
  550.  
  551.             See also    MGL_clearViewport()
  552.  
  553.  
  554.             MGL_clearViewport
  555.  
  556.             Function    Clears the currently active viewport.
  557.  
  558.             Syntax      void MGL_clearViewport(void);
  559.  
  560.             Prototype   mgraph.h
  561.             in
  562.  
  563.             Remarks     MGL_clearViewport() will clear the currently
  564.                         active display page viewport in the current
  565.                         background color. This is the fastest way to
  566.                         clear a rectangular viewport, but you may
  567.                         also wish to use the MGL_fillRect() routine
  568.                         to fill in an arbitrary pattern instead, as
  569.                         the MGL_clearViewport() always clears the
  570.                         viewport in a solid color.
  571.  
  572.             See also    MGL_clearDevice()
  573.  
  574.  
  575.             MGL_clipLine
  576.  
  577.             Function    Clips a line to a specified clipping
  578.                         rectangle.
  579.  
  580.             Syntax      bool MGL_clipLine(point *p1,point *p2,rect
  581.                         r);
  582.  
  583.             Prototype   mgraph.h
  584.             in
  585.  
  586.             Parameters  p1,p2 - Endpoints of line to clip.
  587.                         r - Rectangle to clip the line to
  588.  
  589.             Remarks     MGL_clipLine() will clip the line from point
  590.                         p1(x,y) to point p2(x.y) to the specified
  591.                         clipping rectangle. If the line is accepted
  592.                         (ie: it intersects with the clipping
  593.                         rectangle) then the routine will return true
  594.                         and the line enpoints will be updated to
  595.                         reflect the clipped lines new endpoints. If
  596.                         the line is completely outside of the
  597.                         clipping rectangle, the routine will return
  598.                         false.
  599.  
  600.             Return      True if line is visible, false if completely
  601.             value       outside rectangle.
  602.  
  603.  
  604.             Chapter 6 - Console Library                                9
  605.  
  606.  
  607.  
  608.  
  609.  
  610.  
  611.  
  612.  
  613.             MGL_copyImage
  614.  
  615.             Function    Copies of block of video memory.
  616.  
  617.             Syntax      void MGL_copyImage(rect r,int dl,int dt,int
  618.                         sp,int dp)
  619.  
  620.             Prototype   mgraph.h
  621.             in
  622.  
  623.             Parameters  r - Rectangle specifying the region to copy
  624.                         dl - Left coordinate of destination location
  625.                         dt - Top coordinate of destination location
  626.                         sp - Source image page
  627.                         dp - Destination image page
  628.  
  629.             Remarks     MGL_copyImage() copies the data of a
  630.                         rectangular region of the specified display
  631.                         page to another location, either on the same
  632.                         page or on a different page. If the source
  633.                         and destination regions overlap, the image
  634.                         will be correctly copied.
  635.  
  636.                         NOTE: No clipping is done in this routine, so
  637.                         you can copy data outside of the
  638.                         current viewport.
  639.  
  640.             See also    MGL_copyImageCoord()
  641.  
  642.  
  643.             MGL_copyImageCoord
  644.  
  645.             Function    Copies of block of video memory.
  646.  
  647.             Syntax      void MGL_copyImageCoord(int left,int top,int
  648.                         right,int bottom,int dl,int dt,int sp,int dp)
  649.  
  650.             Prototype   mgraph.h
  651.             in
  652.  
  653.             Parameters  left - Left coordinate of source region
  654.                         top - Top coordinate of source region
  655.                         right - Right coordinate of source region
  656.                         bottom - Bottom coordinate of source region
  657.                         dl - Left coordinate of destination location
  658.                         dt - Top coordinate of destination location
  659.                         sp - Source image page
  660.                         dp - Destination image page
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.  
  668.  
  669.  
  670.  
  671.             10                      MegaGraph Graphics Library Reference
  672.  
  673.  
  674.  
  675.  
  676.  
  677.  
  678.             Remarks     MGL_copyImageCoord() copies the data of a
  679.                         rectangular region of the specified display
  680.                         page to another location, either on the same
  681.                         page or on a different page. If the source
  682.                         and destination regions overlap, the image
  683.                         will be correctly copied.
  684.  
  685.                         NOTE: No clipping is done in this routine, so
  686.                         you can copy data outside of the
  687.                         current viewport.
  688.  
  689.             See also    MGL_copyImage()
  690.  
  691.  
  692.             MGL_defaultAttributes
  693.  
  694.             Function    Reset global attributes to their default
  695.                         values.
  696.  
  697.             Syntax      void MGL_defaultAttributes(void);
  698.  
  699.             Prototype   mgraph.h
  700.             in
  701.  
  702.             Remarks     MGL_defaultAttributes() resets all of the
  703.                         global attributes to their default values.
  704.                         MGL_defaultAttributes() does not reset the
  705.                         current palette.
  706.  
  707.             See also    MGL_getAttributes(), MGL_setAttributes(),
  708.                         MGL_getDefaultPalette()
  709.  
  710.  
  711.             MGL_defaultColor
  712.  
  713.             Function    Returns the default color value for the video
  714.                         mode.
  715.  
  716.             Syntax      color_t MGL_defaultColor(void);
  717.  
  718.             Prototype   mgraph.h
  719.             in
  720.  
  721.             Remarks     MGL_defaultColor() returns a default color
  722.                         values for the current video mode. This color
  723.                         value is white if the palette has not been
  724.                         changed, and will always be white in direct
  725.                         color modes.
  726.  
  727.             Return      Default color value for current video mode.
  728.             value
  729.  
  730.             See also    MGL_setColor(), MGL_getColor()
  731.  
  732.  
  733.  
  734.  
  735.  
  736.  
  737.  
  738.             Chapter 6 - Console Library                               11
  739.  
  740.  
  741.  
  742.  
  743.  
  744.  
  745.             MGL_detectGraph
  746.  
  747.             Function    Detects the currently installed video
  748.                         hardware.
  749.  
  750.             Syntax      void MGL_detectGraph(int far *graphdriver,int
  751.                         far *graphmode);
  752.  
  753.             Prototype   mgraph.h
  754.             in
  755.  
  756.             Parameters  graphdriver - Pointer to graphics device
  757.                         driver id
  758.                         graphmode - Pointer to default video mode for
  759.                         device
  760.  
  761.             Remarks     MGL_detectGraph() autodetects the presence of
  762.                         all the standard graphics adapters supported
  763.                         by the MGL. If no suitable hardware is
  764.                         detected, it returns grNONE in the
  765.                         graphdriver parameter. If suitable hardware
  766.                         is detected, it will return an appropriate
  767.                         device driver id number in the graph driver
  768.                         parameter and a suggested default video mode
  769.                         in the graphmode parameter.
  770.  
  771.                         The video device drivers currently supported
  772.                         by the MGL are:
  773.  
  774.                         grDETECT  - Auto detect the graphics
  775.                         subsystem
  776.                         grNONE    - No graphics hardware detected
  777.                         grEGA     - Standard EGA with 256k RAM
  778.                         grVGA     - Standard VGA
  779.                         grSVGA    - VESA VBE compliant Super VGA
  780.                         grSVGA_S3 - S3 accelerated SuperVGA
  781.  
  782.                         The MGL supports a number of different video
  783.                         mode resolutions, ranging from 320x200 up to
  784.                         1280x1024 with color ranges from 16 colors up
  785.                         to 16.7 million colors. Thus the video mode
  786.                         id for 320x200 16 color EGA graphics mode is
  787.                         grEGA_320x200x16, and the 1280x1024 16.7
  788.                         million color mode is grSVGA_1280x1024x16m.
  789.                         Please consult the MGRAPH.H header file for a
  790.                         full list of defined video modes (to large to
  791.                         list here).
  792.  
  793.                         Once you have called MGL_detectGraph(), you
  794.                         can then call the MGL_availableModes and
  795.                         MGL_availablePages to determine all the
  796.                         available video modes for the currently
  797.                         installed driver and the number of available
  798.                         video pages for each video mode.
  799.  
  800.             See also    MGL_init()
  801.  
  802.  
  803.  
  804.  
  805.             12                      MegaGraph Graphics Library Reference
  806.  
  807.  
  808.  
  809.  
  810.  
  811.  
  812.             MGL_disjointRect
  813.  
  814.             Function    Determines if two rectangles are disjoint.
  815.  
  816.             Syntax      bool MGL_disjointRect(recy r1,rect r2)
  817.  
  818.             Prototype   mgraph.h
  819.             in
  820.  
  821.             Parameters  r1 - First rectangle to test
  822.                         r2 - Second rectangle to test
  823.  
  824.             Remarks     MGL_disjointRect() will determine if two
  825.                         rectangles are non-overlapping (ie: the
  826.                         intersection between the rectangles is zero).
  827.                         If they are disjoint, it will return true,
  828.                         otherwise it will return false.
  829.  
  830.             Return      True if the rectangles are disjoint, false if
  831.             value       not.
  832.  
  833.             See also    MGL_emptyRect(), MGL_equalRect(),
  834.                         MGL_offsetRect(), MGL_insetRect(),
  835.                         MGL_ptInRect().
  836.  
  837.  
  838.             MGL_divotSize
  839.  
  840.             Function    Number of bytes required to store the divot.
  841.  
  842.             Syntax      long MGL_divotSize(rect r)
  843.  
  844.             Prototype   mgraph.h
  845.             in
  846.  
  847.             Parameters  r - Rectangle defining the divot area.
  848.  
  849.             Remarks     MGL_divotSize() determines the number of
  850.                         bytes required to store a particular video
  851.                         memory divot.
  852.  
  853.             Return      Size of the specified divot in bytes.
  854.             value
  855.  
  856.             See also    MGL_getDivot(), MGL_getDivotCoord(),
  857.                         MGL_putDivot()
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865.  
  866.  
  867.  
  868.  
  869.  
  870.  
  871.  
  872.             Chapter 6 - Console Library                               13
  873.  
  874.  
  875.  
  876.  
  877.  
  878.  
  879.             MGL_divotSizeCoord
  880.  
  881.             Function    Number of bytes required to store the divot.
  882.  
  883.             Syntax      long MGL_divotSizeCoord(int left,int top,int
  884.                         right,int bottom)
  885.  
  886.             Prototype   mgraph.h
  887.             in
  888.  
  889.             Parameters  left - Left coordinate of divot area
  890.                         top - Top coordinate of divot area
  891.                         right - Right coordinate of divot area
  892.                         bottom - Bottom coordinate of divot area
  893.  
  894.             Remarks     MGL_divotSizeCoord() determines the number of
  895.                         bytes required to store a particular video
  896.                         memory divot.
  897.  
  898.             Return      Size of the specified divot in bytes.
  899.             value
  900.  
  901.             See also    MGL_getDivot(), MGL_getDivotCoord(),
  902.                         MGL_putDivot()
  903.  
  904.  
  905.             MGL_doubleBuffer
  906.  
  907.             Function    Sets up for double buffering if possible.
  908.  
  909.             Syntax      bool MGL_doubleBuffer(void);
  910.  
  911.             Prototype   mgraph.h
  912.             in
  913.  
  914.             Remarks     MGL_doubleBuffer() will attempt to enable
  915.                         double buffering for the current video mode.
  916.                         If double buffering is enabled, then the
  917.                         routine will return true, otherwise it will
  918.                         return false and single buffer mode will
  919.                         still be enabled.
  920.  
  921.                         MGL_doubleBuffer() will attempt to perform
  922.                         double buffering using an offscreen memory
  923.                         buffer if only one video memory page is
  924.                         supported by the hardware, so it is a
  925.                         transparent method of enabling simple double
  926.                         buffered animation.
  927.  
  928.                         NOTE: The current version of the MGL does not
  929.                         yet support off screen memory buffers (mostly
  930.                         because of memory requirements in real mode -
  931.                         the protected mode version of the library
  932.                         will, and limited support will be provided in
  933.                         real mode for the next version).
  934.  
  935.             Return      True if double buffering is now enabled.
  936.             value
  937.  
  938.  
  939.             14                      MegaGraph Graphics Library Reference
  940.  
  941.  
  942.  
  943.  
  944.  
  945.  
  946.  
  947.             See also    MGL_singleBuffer(), MGL_swapBuffers()
  948.  
  949.  
  950.             MGL_drawBorder
  951.  
  952.             Function    Draws a 3D border around the specified
  953.                         rectangle.
  954.  
  955.             Syntax      void MGL_drawBorder(rect r,int style,int
  956.                         thickness)
  957.  
  958.             Prototype   mgraph.h
  959.             in
  960.  
  961.             Parameters  r - Rectangle defining the region to draw the
  962.                         border around
  963.                         style - Type of border to draw
  964.                         thickness - Thickness of the border in pixels
  965.  
  966.             Remarks     MGL_drawBorder() draws a 3D style border
  967.                         around the specified rectangle in the
  968.                         specified border style and thickness. The
  969.                         different border styles are defined in the
  970.                         MGRAPH.H header file as:
  971.  
  972.                         BDR_INSET    - Interior is inset into display
  973.                         BDR_OUTSET   - Interior is outset from
  974.                         display
  975.                         BDR_OUTLINE  - Border is a 3D outline
  976.  
  977.                         Thus if you wish to create the effect of a 3D
  978.                         style push button, you would use the
  979.                         BDR_OUTSET style to make it appear to be
  980.                         protruding from the display screen. To make
  981.                         it look like it is depressed, use the
  982.                         BDR_INSET style to make it appear to be inset
  983.                         into the display. The BDR_OUTLINE style is
  984.                         used to create a 3D looking rectangle just
  985.                         inside the rectangle boundaries for grouping
  986.                         things together in a user interface dialog
  987.                         box.
  988.  
  989.                         The border is completely contained within the
  990.                         specified bounding rectangle.
  991.  
  992.                         The color of the border's highlights are
  993.                         determined by the currently active border
  994.                         color values.
  995.  
  996.             See also    MGL_drawBorderCoord(), MGL_drawHDivider(),
  997.                         MGL_drawVDivider(), MGL_setBorderColors()
  998.  
  999.  
  1000.  
  1001.  
  1002.  
  1003.  
  1004.  
  1005.  
  1006.             Chapter 6 - Console Library                               15
  1007.  
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.             MGL_drawBorderCoord
  1014.  
  1015.             Function    Draws a 3D border around the specified
  1016.                         rectangle.
  1017.  
  1018.             Syntax      MGL_drawBorderCoord(int left,int top,int
  1019.                         right,int bottom,int style,int thickness);
  1020.  
  1021.             Prototype   mgraph.h
  1022.             in
  1023.  
  1024.             Parameters  r - Rectangle defining the region to draw the
  1025.                         border around
  1026.                         style - Type of border to draw
  1027.                         thickness - Thickness of the border in pixels
  1028.  
  1029.             Remarks     MGL_drawBorderCoord() draws a 3D style border
  1030.                         around the specified rectangle in the
  1031.                         specified border style and thickness. The
  1032.                         different border styles are defined in the
  1033.                         MGRAPH.H header file as:
  1034.  
  1035.                         BDR_INSET    - Interior is inset into display
  1036.                         BDR_OUTSET   - Interior is outset from
  1037.                         display
  1038.                         BDR_OUTLINE  - Border is a 3D outline
  1039.  
  1040.                         Thus if you wish to create the effect of a 3D
  1041.                         style push button, you would use the
  1042.                         BDR_OUTSET style to make it appear to be
  1043.                         protruding from the display screen. To make
  1044.                         it look like it is depressed, use the
  1045.                         BDR_INSET style to make it appear to be inset
  1046.                         into the display. The BDR_OUTLINE style is
  1047.                         used to create a 3D looking rectangle just
  1048.                         inside the rectangle boundaries for grouping
  1049.                         things together in a user interface dialog
  1050.                         box.
  1051.  
  1052.                         The border is completely contained within the
  1053.                         specified bounding rectangle.
  1054.  
  1055.                         The color of the border's highlights are
  1056.                         determined by the currently active border
  1057.                         color values.
  1058.  
  1059.             See also    MGL_drawBorder(), MGL_drawHDivider(),
  1060.                         MGL_drawVDivider(), MGL_setBorderColors()
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066.  
  1067.  
  1068.  
  1069.  
  1070.  
  1071.  
  1072.  
  1073.             16                      MegaGraph Graphics Library Reference
  1074.  
  1075.  
  1076.  
  1077.  
  1078.  
  1079.  
  1080.             MGL_drawHDivider
  1081.  
  1082.             Function    Draws a 3D looking horizontal dividing line
  1083.  
  1084.             Syntax      void MGL_drawHDivider(int y,int x1,int x2);
  1085.  
  1086.             Prototype   mgraph.h
  1087.             in
  1088.  
  1089.             Parameters  y - Y coordinate to draw the line at
  1090.                         x1 - Starting X coordinate
  1091.                         x2 - Ending X coordinate
  1092.  
  1093.             Remarks     MGL_drawHDivider() draws a 3D horizontal
  1094.                         dividing line beginning at the position
  1095.                         (x1,y) and ending at the position (x2,y).
  1096.  
  1097.                         The color of the dividing line is determine
  1098.                         by the currently active border colors values.
  1099.  
  1100.             See also    MGL_drawVDivider(), MGL_drawBorder(),
  1101.                         MGL_setBorderColors()
  1102.  
  1103.  
  1104.             MGL_drawStr
  1105.  
  1106.             Function    Draws a text string on the display.
  1107.  
  1108.             Syntax      void MGL_drawStr(const char *str);
  1109.  
  1110.             Prototype   mgraph.h
  1111.             in
  1112.  
  1113.             Parameters  str - String to display
  1114.  
  1115.             Remarks     MGL_drawStr() draws the specified string at
  1116.                         the current position (CP) in the current
  1117.                         drawing color, write mode, font, text
  1118.                         direction and justification. The CP is moved
  1119.                         so that drawing will begin directly after the
  1120.                         end of the string, only if the horizontal
  1121.                         justification is set to LEFT_TEXT, otherwise
  1122.                         the CP is not moved.
  1123.  
  1124.             See also    MGL_drawStrXY(), MGL_textHeight(),
  1125.                         MGL_textWidth(), MGL_useFont()
  1126.  
  1127.  
  1128.  
  1129.  
  1130.  
  1131.  
  1132.  
  1133.  
  1134.  
  1135.  
  1136.  
  1137.  
  1138.  
  1139.  
  1140.             Chapter 6 - Console Library                               17
  1141.  
  1142.  
  1143.  
  1144.  
  1145.  
  1146.  
  1147.             MGL_drawStrXY
  1148.  
  1149.             Function    Draws a text string on the display.
  1150.  
  1151.             Syntax      void MGL_drawStrXY(int x,int y,const char
  1152.                         *str);
  1153.  
  1154.             Prototype   mgraph.h
  1155.             in
  1156.  
  1157.             Parameters  x - X coordinate to begin rendering the
  1158.                         string at
  1159.                         y - Y coordinate to begin rendering the
  1160.                         string at
  1161.                         str - String to display
  1162.  
  1163.             Remarks     MGL_drawStrXY   draws the specified string at
  1164.                                      ()
  1165.                         the specified (x,y) position in the current
  1166.                         drawing color, write mode, font, text
  1167.                         direction and justification.
  1168.  
  1169.             See also    MGL_drawStrXY(), MGL_textHeight(),
  1170.                         MGL_textWidth(), MGL_useFont()
  1171.  
  1172.  
  1173.             MGL_drawVDivider
  1174.  
  1175.             Function    Draws a 3D looking vertical dividing line
  1176.  
  1177.             Syntax      void MGL_drawVDivider(int x,int y1,int y2);
  1178.  
  1179.             Prototype   mgraph.h
  1180.             in
  1181.  
  1182.             Parameters  x - X coordinate to begin drawing divider
  1183.                         y1 - Starting Y coordinate
  1184.                         y2 - Ending Y coordinate
  1185.  
  1186.             Remarks     MGL_drawVDivider() draws a 3D vertical
  1187.                         dividing line beginning at the position
  1188.                         (x,y1) and ending at the position (x,y2).
  1189.  
  1190.                         The color of the dividing line is determine
  1191.                         by the currently active border colors values.
  1192.  
  1193.             See also    MGL_drawHDivider(), MGL_drawBorder(),
  1194.                         MGL_setBorderColors()
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.  
  1201.  
  1202.  
  1203.  
  1204.  
  1205.  
  1206.  
  1207.  
  1208.             18                      MegaGraph Graphics Library Reference
  1209.  
  1210.  
  1211.  
  1212.  
  1213.  
  1214.  
  1215.             MGL_driverName
  1216.  
  1217.             Function    Returns a string describing the name of the
  1218.                         device driver.
  1219.  
  1220.             Syntax      char *MGL_driverName(int driver);
  1221.  
  1222.             Prototype   mgraph.h
  1223.             in
  1224.  
  1225.             Parameters  driver - Device driver id number.
  1226.  
  1227.             Remarks     MGL_driverName() returns a string describing
  1228.                         the a device driver given a device driver
  1229.                         number.
  1230.  
  1231.             Return      Pointer to device driver name string.
  1232.             value
  1233.  
  1234.             See also    MGL_modeName()
  1235.  
  1236.  
  1237.             MGL_ellipse
  1238.  
  1239.             Function    Draws an ellipse outline defined by a
  1240.                         bounding rectangle.
  1241.  
  1242.             Syntax      bool MGL_ellipse(rect extentRect);
  1243.  
  1244.             Prototype   mgraph.h
  1245.             in
  1246.  
  1247.             Parameters  extentRect - Bounding rectangle defining the
  1248.                         ellipse.
  1249.  
  1250.             Remarks     MGL_ellipse() draws the outline of an ellipse
  1251.                         just inside the mathematical boundary of
  1252.                         extentRect. The ellipse outline is drawn in
  1253.                         the current pen color, style and size.
  1254.  
  1255.                         Note: This routine is more versatile than the
  1256.                         equivalent MGL_ellipseCoord() routine, as you
  1257.                         can have an ellipse with odd diameters
  1258.                         values, which you cannot get with the
  1259.                         MGL_ellipseCoord() routine.
  1260.  
  1261.             Return      True if ellipse was scan converted, false if
  1262.             value       an error occured (MGL_buf too small)..
  1263.  
  1264.             See also    MGL_ellipseCoord(), MGL_fillEllipse(),
  1265.                         MGL_fillEllipseCoord()
  1266.  
  1267.  
  1268.  
  1269.  
  1270.  
  1271.  
  1272.  
  1273.  
  1274.  
  1275.             Chapter 6 - Console Library                               19
  1276.  
  1277.  
  1278.  
  1279.  
  1280.  
  1281.  
  1282.             MGL_ellipseArc
  1283.  
  1284.             Function    Draws an elliptical arc outline defined by a
  1285.                         bounding rectangle.
  1286.  
  1287.             Syntax      bool MGL_ellipseArc(rect extentRect,int
  1288.                         startAngle,int endAngle);
  1289.  
  1290.             Prototype   mgraph.h
  1291.             in
  1292.  
  1293.             Parameters  extentRect - Bounding rectangle defining the
  1294.                         arc.
  1295.                         startAngle - Starting angle for arc (in
  1296.                         degrees)
  1297.                         endAngle - Ending angle for arc (in degrees).
  1298.  
  1299.             Remarks     MGL_ellipseArc() draw the outline of an
  1300.                         elliptical arc just inside the mathematical
  1301.                         boundary of extentRect. StartAngle specifies
  1302.                         where the arc begins and is treated MOD 360.
  1303.                         EndAngle specifies where the arc ends and is
  1304.                         treated MOD 360 also. The angles are given in
  1305.                         positive or negative degrees. Zero degrees is
  1306.                         at 3 o'clock, 90 is at 12 o'clock high, 180
  1307.                         is at 9 o'clock and 270 is at 6 o'clock.
  1308.                         Other angles are measured relative to the
  1309.                         enclosing rectangle. Thus an angle of 45
  1310.                         degrees always defines a line from the centre
  1311.                         of the rectangle through it's top right
  1312.                         corner, even if the rectangle isn't square.
  1313.  
  1314.                         The ellipse outline if drawn in the current
  1315.                         pen color, style and size (note that the
  1316.                         current version of the MGL only works with a
  1317.                         1x1 pen size with a solid pattern for
  1318.                         elliptical arcs).
  1319.  
  1320.                         Note: This routine is more versatile than the
  1321.                         equivalent MGL_ellipseArcCoord() routine, as
  1322.                         you can have an elliptical arc with odd
  1323.                         diameters values, which you cannot get with
  1324.                         the MGL_ellipseArcCoord() routine.
  1325.  
  1326.             Return      True if the ellipse arc was scan converted,
  1327.             value       false if an error occurred (MGL_buf too
  1328.                         small).
  1329.  
  1330.             See also    MGL_ellipseArcCoord(), MGL_fillEllipseArc(),
  1331.                         MGL_fillEllipseArcCoord()
  1332.  
  1333.  
  1334.  
  1335.  
  1336.  
  1337.  
  1338.  
  1339.  
  1340.  
  1341.  
  1342.             20                      MegaGraph Graphics Library Reference
  1343.  
  1344.  
  1345.  
  1346.  
  1347.  
  1348.  
  1349.             MGL_ellipseArcCoord
  1350.  
  1351.             Function    Draws an elliptical arc outline defined by a
  1352.                         centre and radii.
  1353.  
  1354.             Syntax      bool MGL_ellipseArcCoord(int x,int y,int
  1355.                         xradius,int yradius,int startAngle,int
  1356.                         endAngle);
  1357.  
  1358.             Prototype   mgraph.h
  1359.             in
  1360.  
  1361.             Parameters  x,y - Centre of the elliptical arc.
  1362.                         xradius - X radius for the elliptical arc
  1363.                         yradius - Y radius for the elliptical arc
  1364.                         startAngle - Starting angle for arc (in
  1365.                         degrees)
  1366.                         endAngle - Ending angle for arc (in degrees).
  1367.  
  1368.             Remarks     MGL_ellipseArcCoord() draws the outline of an
  1369.                         elliptical arc given the centre, radii and
  1370.                         starting and endling angles. StartAngle
  1371.                         specifies where the arc begins and is treated
  1372.                         MOD 360. EndAngle specifies where the arc
  1373.                         ends and is treated MOD 360 also. The angles
  1374.                         are given in positive or negative degrees.
  1375.                         Zero degrees is at 3 o'clock, 90 is at 12
  1376.                         o'clock high, 180 is at 9 o'clock and 270 is
  1377.                         at 6 o'clock. Other angles are measured
  1378.                         relative to the enclosing rectangle. Thus an
  1379.                         angle of 45 degrees always defines a line
  1380.                         from the centre of the rectangle through it's
  1381.                         top right corner, even if the rectangle isn't
  1382.                         square.
  1383.  
  1384.                         The ellipse outline if drawn in the current
  1385.                         pen color, style and size (note that the
  1386.                         current version of the MGL only works with a
  1387.                         1x1 pen size with a solid pattern).
  1388.  
  1389.                         Note: This routine can only work with integer
  1390.                         semi-major and semi-minor axes, but can
  1391.                         sometimes be easier to work with (and it
  1392.                         provided for compatabilty with other graphics
  1393.                         packages).
  1394.  
  1395.             Return      True if the ellipse arc was scan converted,
  1396.             value       false if an error occurred (MGL_buf too
  1397.                         small).
  1398.  
  1399.             See also    MGL_ellipseArc(), MGL_fillEllipseArc(),
  1400.                         MGL_fillEllipseArcCoord()
  1401.  
  1402.  
  1403.  
  1404.  
  1405.  
  1406.  
  1407.  
  1408.  
  1409.             Chapter 6 - Console Library                               21
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.             MGL_ellipseCoord
  1417.  
  1418.             Function    Draws an ellipse outline defined by a
  1419.                         bounding rectangle.
  1420.  
  1421.             Syntax      bool MGL_ellipseCoord(int x,int y,int
  1422.                         xradius,int yradius);
  1423.  
  1424.             Prototype   mgraph.h
  1425.             in
  1426.  
  1427.             Parameters  x,y - Centre of the ellipse
  1428.                         xradius - X radius for the ellipse
  1429.                         yradius - Y radius for the ellipse
  1430.  
  1431.             Remarks     MGL_ellipse() draws the outline of an ellipse
  1432.                         given the centre and radii for the ellipse.
  1433.                         The ellipse outline if drawn in the current
  1434.                         pen color, style and size.
  1435.  
  1436.                         Note: This routine can only work with integer
  1437.                         semi-major and semi-minor axes, but can
  1438.                         sometimes be easier to work with (and it
  1439.                         provided for compatability with other
  1440.                         graphics packages).
  1441.  
  1442.             Return      True if ellipse was scan converted, false if
  1443.             value       an error occured (MGL_buf too small)..
  1444.  
  1445.             See also    MGL_ellipse(), MGL_fillEllipse(),
  1446.                         MGL_fillEllipseCoord()
  1447.  
  1448.  
  1449.             MGL_ellipseEngine
  1450.  
  1451.             Function    Generates the set of points on an ellipse.
  1452.  
  1453.             Syntax      void MGL_ellipseEngine(rect extentRect,void
  1454.                         (*setup)(int topY,int botY,int left,int
  1455.                         right),void (*set4pixels)(bool inc_x,bool
  1456.                         inc_y,bool region1),void (*finished)(void));
  1457.  
  1458.             Prototype   mgraph.h
  1459.             in
  1460.  
  1461.             Parameters  extentRect - Bounding rectangle defining the
  1462.                         ellipse.
  1463.                         setup - Routine called to intialise pixel
  1464.                         plotting routines.
  1465.                         set4pixels - Routine called repeatedly for
  1466.                         each set of 4 pixels.
  1467.                         finished - Routine called to complete
  1468.                         plotting pixels.
  1469.  
  1470.  
  1471.  
  1472.  
  1473.  
  1474.  
  1475.  
  1476.             22                      MegaGraph Graphics Library Reference
  1477.  
  1478.  
  1479.  
  1480.  
  1481.  
  1482.  
  1483.             Remarks     MGL_ellipseEngine() is the same engine used
  1484.                         to generate all ellipse's and elliptical arc
  1485.                         in the MGL. You can call it to generate the
  1486.                         set of points on an ellipse, calling your own
  1487.                         user defined plotting routines.
  1488.  
  1489.                         The setup routine is called before any pixel
  1490.                         are plotted with the coordinates of the 4
  1491.                         seed points in the four ellipse quadrants.
  1492.  
  1493.                             set4pixels
  1494.                         The            routine is called repeatedly
  1495.                         for each set of 4 pixels to be plotted, and
  1496.                         specified whether the coordinates in the x
  1497.                         and y directions should be incremented or
  1498.                         remain the same. This state of the 4 pixel
  1499.                         coordinates will need to be maintained by the
  1500.                         user supplied routines.
  1501.  
  1502.                             finished
  1503.                         The          routine is called to clean up
  1504.                         after generating all the points on the
  1505.                         ellipse, such as releasing memory and
  1506.                         rendering the ellipse if the rendering was
  1507.                         deferred.
  1508.  
  1509.  
  1510.             MGL_emptyRect
  1511.  
  1512.             Function    Determines if a rectangle is empty.
  1513.  
  1514.             Syntax      bool MGL_emptyRect(rect r)
  1515.  
  1516.             Prototype   mgraph.h
  1517.             in
  1518.  
  1519.             Parameters  r - rectangle to test
  1520.  
  1521.             Remarks     MGL_emptyRect() determine if a rectangle is
  1522.                         empty. A rectangle is defined as being empty
  1523.                         if the right coordinate is less than or equal
  1524.                         to the left coordinate, or if the bottom
  1525.                         coordinate is less than or equal to the top
  1526.                         coordinate.
  1527.  
  1528.             Return      True if rectangle is empty, false if not.
  1529.             value
  1530.  
  1531.             See also    MGL_disjointRect(), MGL_equalRect(),
  1532.                         MGL_offsetRect(), MGL_insetRect(),
  1533.                         MGL_ptInRect().
  1534.  
  1535.  
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.             Chapter 6 - Console Library                               23
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.             MGL_endDrawing
  1553.  
  1554.             Function    Finish high performance drawing operation.
  1555.  
  1556.             Syntax      void MGL_endDrawing(void);
  1557.  
  1558.             Prototype   mgraph.h
  1559.             in
  1560.  
  1561.             Remarks     MGL_endDrawing() is called to end a set of
  1562.                         high performance drawing operations that we
  1563.                         started with the MGL_beginDrawing()
  1564.                         operation.
  1565.  
  1566.                         All high performance drawing primitives end
  1567.                         the word 'Fast', and must be bracketed
  1568.                         between calls to MGL_beginDrawing() and
  1569.                         MGL_endDrawing(). You may mix and match any
  1570.                         of the fast drawing routines and normal
  1571.                         library functions within an
  1572.                         MGL_beginDrawing() and MG_endDrawing() block.
  1573.                         You can also nest calls to MGL_beginDrawing()
  1574.                         and MGL_endDrawing() (hence you can write
  1575.                         your own functions that use the fast
  1576.                         rendering routines but do not require the
  1577.                         user to call MGL_beginDrawing() before
  1578.                         calling your routine).
  1579.  
  1580.                             must
  1581.                         You      ensure that you call the
  1582.                         MGL_endDrawing routine after drawing a set of
  1583.                         high performance primitives.
  1584.  
  1585.             See also    MGL_beginDrawing(), MGL_*fast()
  1586.  
  1587.  
  1588.             MGL_endGouraud
  1589.  
  1590.             Function    Complete Gouraud Shaded drawing operation.
  1591.  
  1592.             Syntax      void MGL_endGouraud(void);
  1593.  
  1594.             Prototype   mgraph.h
  1595.             in
  1596.  
  1597.             Remarks     MGL_endGouraud() is called to end the
  1598.                         rendering of gouraud shaded primitives, such
  1599.                         as the MGL_fillGouraudPolygon() routine.
  1600.  
  1601.                         You should not call any other routines except
  1602.                         the gouraud shading routines between calls to
  1603.                         MGL_beginGouraud and MGL_endGouraud, and you
  1604.                         should not nest calls to this routine.
  1605.  
  1606.             See also    MGL_beginGouraud()
  1607.  
  1608.  
  1609.  
  1610.  
  1611.  
  1612.  
  1613.             24                      MegaGraph Graphics Library Reference
  1614.  
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.             MGL_endPixel
  1621.  
  1622.             Function    End high speed pixel drawing operation.
  1623.  
  1624.             Syntax      void MGL_endPixel(void);
  1625.  
  1626.             Prototype   mgraph.h
  1627.             in
  1628.  
  1629.             Remarks     MGL_endPixel() ends a set of high speed pixel
  1630.                         drawing operations.
  1631.  
  1632.                         This routine is intended primarily to ensure
  1633.                         fast operation if you intend to plot more
  1634.                         than a single pixel at a time, so it will be
  1635.                         done as fast as possible.
  1636.  
  1637.             See also    MGL_beginPixel()
  1638.  
  1639.  
  1640.             MGL_equalPoint
  1641.  
  1642.             Function    Determines if two points are equal.
  1643.  
  1644.             Syntax      bool MGL_equalPoint(point p1,point p2);
  1645.  
  1646.             Prototype   mgraph.h
  1647.             in
  1648.  
  1649.             Parameters  p1 - First point to compare
  1650.                         p2 - Second point to compare
  1651.  
  1652.             Remarks     MGL_equalPoint() determines if the value of
  1653.                         two coordinates are equal, returning true if
  1654.                         they are.
  1655.  
  1656.             Return      True if the points are equal, false if not.
  1657.             value
  1658.  
  1659.  
  1660.             MGL_equalRect
  1661.  
  1662.             Function    Determines if two rectangles are equal.
  1663.  
  1664.             Syntax      bool MGL_equalRect(rect r1,rect r2);
  1665.  
  1666.             Prototype   mgraph.h
  1667.             in
  1668.  
  1669.             Parameters  r1 - First rectangle to compare
  1670.                         r2 - Second rectangle to compare
  1671.  
  1672.             Remarks     MGL_equalRect() compares the values of two
  1673.                         rectangles and determines if they are equal,
  1674.                         returning true if they are.
  1675.  
  1676.             Return      True if the rectangles are equal.
  1677.             value
  1678.  
  1679.  
  1680.             Chapter 6 - Console Library                               25
  1681.  
  1682.  
  1683.  
  1684.  
  1685.  
  1686.  
  1687.  
  1688.             See also    MGL_disjointRect(), MGL_emptyRect(),
  1689.                         MGL_offsetRect(), MGL_insetRect(),
  1690.                         MGL_ptInRect().
  1691.  
  1692.  
  1693.             MGL_errorMsg
  1694.  
  1695.             Function    Returns a string describing an error
  1696.                         condition.
  1697.  
  1698.             Syntax      char *MGL_errorMsg(int err);
  1699.  
  1700.             Prototype   mgraph.h
  1701.             in
  1702.  
  1703.             Parameters  err - Error code to obtain string for.
  1704.  
  1705.             Remarks     MGL_errorMsg() returns a pointer to a string
  1706.                         describing a specified error condition. You
  1707.                         can use this to convert the error codes from
  1708.                         a numerical id return by MGL_result() to a
  1709.                         string which you can display for the users of
  1710.                         your programs.
  1711.  
  1712.             Return      Pointer to string describing the error
  1713.             value       condition.
  1714.  
  1715.             See also    MGL_result().
  1716.  
  1717.  
  1718.             MGL_exit
  1719.  
  1720.             Function    Closes down the graphics subsystem.
  1721.  
  1722.             Syntax      void MGL_exit(void);
  1723.  
  1724.             Prototype   mgraph.h
  1725.             in
  1726.  
  1727.             Remarks     MGL_exit() closes down the graphics
  1728.                         subsystem, deallocating any memory allocated
  1729.                         for use by the MGL, and restoring the system
  1730.                         back into the original text mode active
  1731.                         before the MGL was started.
  1732.  
  1733.             See also    MGL_init()
  1734.  
  1735.  
  1736.  
  1737.  
  1738.  
  1739.  
  1740.  
  1741.  
  1742.  
  1743.  
  1744.  
  1745.  
  1746.  
  1747.             26                      MegaGraph Graphics Library Reference
  1748.  
  1749.  
  1750.  
  1751.  
  1752.  
  1753.  
  1754.             MGL_fadePalette
  1755.  
  1756.             Function    Fades the values for programming the palette.
  1757.  
  1758.             Syntax      bool MGL_fadePalette(palette *dest,palette
  1759.                         *src,int numColors,uchar intensity);
  1760.  
  1761.             Prototype   mgraph.h
  1762.             in
  1763.  
  1764.             Parameters  dest - Pointer to destination palette
  1765.                         structure.
  1766.                         src - Pointer to source palette structure.
  1767.                         numColors - Number of colors in palette to
  1768.                         fade
  1769.                         intensity - Intensity value for the output
  1770.                         palette values.
  1771.  
  1772.             Remarks     MGL_fadePalette() will take the values from
  1773.                         one palette structure, fade the values and
  1774.                         store them into a second palette structure.
  1775.                         The actual hardware palette will not be
  1776.                         programmed, so you will then need to make a
  1777.                         call to MGL_setPalette() to make the changes
  1778.                         visiable.
  1779.  
  1780.                             intensity
  1781.                         The           value is a number between 0 and
  1782.                         255 that defines the intensity of the output
  1783.                         values. An intensity of 255 will produce the
  1784.                         same output values as the input values. An
  1785.                         intensity of 128 will product values in the
  1786.                         output palette that are half the intensity of
  1787.                         the input palette.
  1788.  
  1789.                         The palette values are manipulated as arrays
  1790.                         of the         structure, defined as:
  1791.                                palette
  1792.  
  1793.                         typedef struct {
  1794.                             uchar   red;
  1795.                             uchar   green;
  1796.                             uchar   blue;
  1797.                             } palette;
  1798.  
  1799.                         where red, green and blue define the color
  1800.                         components for that entry. Each color
  1801.                         component is defined as an 8 bit value with a
  1802.                         range of 0-255.
  1803.  
  1804.                         If the entire output palette is zero, then
  1805.                         the routine will return true, otherwise it
  1806.                         will return true.
  1807.  
  1808.             Return      True if the entire output palette is zero,
  1809.             value       false if not.
  1810.  
  1811.             See also    MGL_setPalette(), MGL_getPalette(),
  1812.                         MGL_rotatePalette()
  1813.  
  1814.  
  1815.  
  1816.             Chapter 6 - Console Library                               27
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.             MGL_fillEllipse
  1824.  
  1825.             Function    Fills an ellipse outline defined by a
  1826.                         bounding rectangle.
  1827.  
  1828.             Syntax      bool MGL_fillEllipse(rect extentRect);
  1829.  
  1830.             Prototype   mgraph.h
  1831.             in
  1832.  
  1833.             Parameters  extentRect - Bounding rectangle defining the
  1834.                         ellipse.
  1835.  
  1836.             Remarks     MGL_fillEllipse() fills an ellipse just
  1837.                         inside the mathematical boundary of
  1838.                         extentRect. The ellipse is filled in the
  1839.                         current pen color and style.
  1840.  
  1841.                         Note: This routine is more versatile than the
  1842.                         equivalent MGL_fillEllipseCoord() routine, as
  1843.                         you can have an ellipse with odd diameters
  1844.                         values, which you cannot get with the
  1845.                         MGL_fillEllipseCoord() routine.
  1846.  
  1847.             Return      True if ellipse was scan converted, false if
  1848.             value       an error occured (MGL_buf too small)..
  1849.  
  1850.             See also    MGL_ellipse(), MGL_ellipseCoord(),
  1851.                         MGL_fillEllipseCoord()
  1852.  
  1853.  
  1854.             MGL_fillEllipseArc
  1855.  
  1856.             Function    Fills an elliptical arc defined by a bounding
  1857.                         rectangle.
  1858.  
  1859.             Syntax      bool MGL_fillEllipseArc(rect extentRect,int
  1860.                         startAngle,int endAngle);
  1861.  
  1862.             Prototype   mgraph.h
  1863.             in
  1864.  
  1865.             Parameters  extentRect - Bounding rectangle defining the
  1866.                         arc.
  1867.                         startAngle - Starting angle for arc (in
  1868.                         degrees)
  1869.                         endAngle - Ending angle for arc (in degrees).
  1870.  
  1871.  
  1872.  
  1873.  
  1874.  
  1875.  
  1876.  
  1877.  
  1878.  
  1879.  
  1880.  
  1881.  
  1882.  
  1883.             28                      MegaGraph Graphics Library Reference
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.  
  1890.             Remarks     MGL_fillEllipseArc() fills an elliptical arc
  1891.                         forming a wedge, just inside the mathematical
  1892.                         boundary of extentRect. StartAngle specifies
  1893.                         where the arc begins and is treated MOD 360.
  1894.                         EndAngle specifies where the arc ends and is
  1895.                         treated MOD 360 also. The angles are given in
  1896.                         positive or negative degrees. Zero degrees is
  1897.                         at 3 o'clock, 90 is at 12 o'clock high, 180
  1898.                         is at 9 o'clock and 270 is at 6 o'clock.
  1899.                         Other angles are measured relative to the
  1900.                         enclosing rectangle. Thus an angle of 45
  1901.                         degrees always defines a line from the centre
  1902.                         of the rectangle through it's top right
  1903.                         corner, even if the rectangle isn't square.
  1904.  
  1905.                         The elliptical arc is filled in the current
  1906.                         pen color and style.
  1907.  
  1908.                         Note: This routine is more versatile than the
  1909.                         equivalent MGL_fillEllipseArcCoord() routine,
  1910.                         as you can have an elliptical arc with odd
  1911.                         diameter values, which you cannot get with
  1912.                         the MGL_fillEllipseArcCoord() routine.
  1913.  
  1914.             Return      True if the ellipse arc was scan converted,
  1915.             value       false if an error occurred (MGL_buf too
  1916.                         small).
  1917.  
  1918.             See also    MGL_fillEllipseArcCoord(), MGL_ellipseArc(),
  1919.                         MGL_ellipseArcCoord()
  1920.  
  1921.  
  1922.             MGL_fillEllipseArcCoord
  1923.  
  1924.             Function    Fills an elliptical arc defined by a centre
  1925.                         and radii.
  1926.  
  1927.             Syntax      bool MGL_fillEllipseArcCoord(int x,int y,int
  1928.                         xradius,int yradius,int startAngle,int
  1929.                         endAngle);
  1930.  
  1931.             Prototype   mgraph.h
  1932.             in
  1933.  
  1934.             Parameters  x,y - Centre of the elliptical arc.
  1935.                         xradius - X radius for the elliptical arc
  1936.                         yradius - Y radius for the elliptical arc
  1937.                         startAngle - Starting angle for arc (in
  1938.                         degrees)
  1939.                         endAngle - Ending angle for arc (in degrees).
  1940.  
  1941.  
  1942.  
  1943.  
  1944.  
  1945.  
  1946.  
  1947.  
  1948.  
  1949.  
  1950.             Chapter 6 - Console Library                               29
  1951.  
  1952.  
  1953.  
  1954.  
  1955.  
  1956.  
  1957.             Remarks     MGL_fillEllipseArcCoord() fills an elliptical
  1958.                         arc forming a wedge, given the centre, radii
  1959.                         and starting and endling angles. StartAngle
  1960.                         specifies where the arc begins and is treated
  1961.                         MOD 360. EndAngle specifies where the arc
  1962.                         ends and is treated MOD 360 also. The angles
  1963.                         are given in positive or negative degrees.
  1964.                         Zero degrees is at 3 o'clock, 90 is at 12
  1965.                         o'clock high, 180 is at 9 o'clock and 270 is
  1966.                         at 6 o'clock. Other angles are measured
  1967.                         relative to the enclosing rectangle. Thus an
  1968.                         angle of 45 degrees always defines a line
  1969.                         from the centre of the rectangle through it's
  1970.                         top right corner, even if the rectangle isn't
  1971.                         square.
  1972.  
  1973.                         The elliptical arc is filled in the current
  1974.                         pen color and style.
  1975.  
  1976.                         Note: This routine can only work with integer
  1977.                         semi-major and semi-minor axes, but can
  1978.                         sometimes be easier to work with (and it
  1979.                         provided for compatabilty with other graphics
  1980.                         packages).
  1981.  
  1982.             Return      True if the ellipse arc was scan converted,
  1983.             value       false if an error occurred (MGL_buf too
  1984.                         small).
  1985.  
  1986.             See also    MGL_ellipseArc(), MGL_ellipseArcCoord(),
  1987.                         MGL_fillEllipseArc().
  1988.  
  1989.  
  1990.             MGL_fillEllipseCoord
  1991.  
  1992.             Function    Fills an ellipse defined by a bounding
  1993.                         rectangle.
  1994.  
  1995.             Syntax      bool MGL_fillEllipseCoord(int x,int y,int
  1996.                         xradius,int yradius);
  1997.  
  1998.             Prototype   mgraph.h
  1999.             in
  2000.  
  2001.             Parameters  x,y - Centre of the ellipse
  2002.                         xradius - X radius for the ellipse
  2003.                         yradius - Y radius for the ellipse
  2004.  
  2005.             Remarks     MGL_fillEllipseCoord() fills an ellipse given
  2006.                         the centre and radii for the ellipse. The
  2007.                         ellipse is filled in the current pen color
  2008.                         and style.
  2009.  
  2010.                         Note: This routine can only work with integer
  2011.                         semi-major and semi-minor axes, but can
  2012.                         sometimes be easier to work with (and it
  2013.                         provided for compatability with other
  2014.                         graphics packages).
  2015.  
  2016.  
  2017.             30                      MegaGraph Graphics Library Reference
  2018.  
  2019.  
  2020.  
  2021.  
  2022.  
  2023.  
  2024.  
  2025.             Return      True if ellipse was scan converted, false if
  2026.             value       an error occured (MGL_buf too small)..
  2027.  
  2028.             See also    MGL_ellipse(), MGL_ellipseCoord(),
  2029.                         MGL_fillEllipse()
  2030.  
  2031.  
  2032.             MGL_fillGouraudPolygon
  2033.  
  2034.             Function    Fills a convex polygon with smooth shading.
  2035.  
  2036.             Syntax      bool MGL_fillGouraudPolygon(int count,point
  2037.                         *vArray,color_t *cArray,int xOffset,int
  2038.                         yOffset);
  2039.  
  2040.             Prototype   mgraph.h
  2041.             in
  2042.  
  2043.             Parameters  count - Number of vertices in polygon
  2044.                         vArray - Array of vertices in polygon
  2045.                         cArray - Array of vertex colors
  2046.                         xOffset - X coordinate offset value
  2047.                         yOffset - Y coordinate offset value
  2048.  
  2049.             Remarks     MGL_fillGouraudPolygon() scan converts a
  2050.                         filled        polygon, while smoothly
  2051.                                convex
  2052.                         interpolating the color values between the
  2053.                         vertices in the polygon. A convex polygon is
  2054.                         defined as a polygon such that every
  2055.                         horizontal line drawn through the polygon
  2056.                         would cross exactly two active edges (neither
  2057.                         horizontal lines nor zero-length edges count
  2058.                         as active edges; both are acceptable anywhere
  2059.                         in the polygon). Right & left edges may cross
  2060.                         (polygons may be nonsimple). Attempting to
  2061.                         scan convert a polygon that does not fit this
  2062.                         description will produce unpredictable
  2063.                         results.
  2064.  
  2065.                         In order to ensure correct scan conversion of
  2066.                         polygons with shared vertices, the right and
  2067.                         bottom edges of the polygons are not scan
  2068.                         converted. All vertices are offset by
  2069.                         (xOffset,yOffset).
  2070.  
  2071.                         Note: You must call MGL_beginGouraud() before
  2072.                         calling this routine, and you      call
  2073.                                                       must 
  2074.                         MGL_endGouraud() after drawing a set of one
  2075.                         or more shaded polygons. You cannot draw
  2076.                         anything else at the same time.
  2077.  
  2078.             Return      True if the polygon was scan converted, false
  2079.             value       if an error occurred.
  2080.  
  2081.             See also    MGL_fillPolygon(), MGL_fillPolygonFast(),
  2082.                         MGL_beginGouraud(), MGL_endGouraud().
  2083.  
  2084.  
  2085.  
  2086.             Chapter 6 - Console Library                               31
  2087.  
  2088.  
  2089.  
  2090.  
  2091.  
  2092.  
  2093.             MGL_fillPolygon
  2094.  
  2095.             Function    Fills an arbitrary polygon.
  2096.  
  2097.             Syntax      bool MGL_fillPolygon(int count,point
  2098.                         *vArray,int xOffset,int yOffset);
  2099.  
  2100.             Prototype   mgraph.h
  2101.             in
  2102.  
  2103.             Parameters  count - Number of vertices in polygon
  2104.                         vArray - Array of vertices in polygon
  2105.                         xOffset - X coordinate offset value
  2106.                         yOffset - Y coordinate offset value
  2107.  
  2108.             Remarks     MGL_fillPolygon() scan converts a filled
  2109.                         arbitrary polygon in the current color and
  2110.                         style. By default the routine will determine
  2111.                         the type of the polygon being scan converted,
  2112.                         and will scan convert convex polygons using a
  2113.                         faster scan conversion routine, otherwise a
  2114.                         general polygon scan conversion routine will
  2115.                         be used. Thus you can scan convert any type
  2116.                         of polygon that you desire.
  2117.  
  2118.                           convex
  2119.                         A        polygon is defined as a polygon such
  2120.                         that every horizontal line drawn through the
  2121.                         polygon would cross exactly two active edges
  2122.                         (neither horizontal lines nor zero-length
  2123.                         edges count as active edges; both are
  2124.                         acceptable anywhere in the polygon). Right &
  2125.                         left edges may cross (polygons may be
  2126.                         nonsimple). Attempting to scan convert a
  2127.                         polygon that does not fit this description
  2128.                         will produce unpredictable results.
  2129.  
  2130.                         Non simple or self intersecting polygons will
  2131.                         be scan converted using the standard in/out
  2132.                         rule, where points are defined as being
  2133.                         inside after crossing the first edge in the
  2134.                         polygon, and then alternate between defined
  2135.                         as inside then outside after crossing each
  2136.                         active edge in the polygon.
  2137.  
  2138.                         In order to ensure correct scan conversion of
  2139.                         polygons with shared vertices, the right and
  2140.                         bottom edges of the polygons are not scan
  2141.                         converted. All vertices are offset by
  2142.                         (xOffset,yOffset).
  2143.  
  2144.                         You may also use the MGL_setPolygonType()
  2145.                         routine to specify the type of polygons being
  2146.                         scan converted. This may be AUTO_POLYGON,
  2147.                         CONVEX_POLYGON or COMPLEX_POLYGON. Explicitly
  2148.                         setting the polygon type will speed the
  2149.                         drawing process.
  2150.  
  2151.  
  2152.  
  2153.  
  2154.             32                      MegaGraph Graphics Library Reference
  2155.  
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161.             Return      True if the polygon was scan converted, false
  2162.             value       if an error occurred.
  2163.  
  2164.             See also    MGL_fillPolygonFast(),
  2165.                         MGL_fillGouraudPolygon, MGL_setPolygonType()
  2166.  
  2167.  
  2168.             MGL_fillPolygonFast
  2169.  
  2170.             Function    Fills a convex polygon quickly.
  2171.  
  2172.             Syntax      bool MGL_fillPolygonFast(int count,point
  2173.                         *vArray,int xOffset,int yOffset);
  2174.  
  2175.             Prototype   mgraph.h
  2176.             in
  2177.  
  2178.             Parameters  count - Number of vertices in polygon
  2179.                         vArray - Array of vertices in polygon
  2180.                         xOffset - X coordinate offset value
  2181.                         yOffset - Y coordinate offset value
  2182.  
  2183.             Remarks     MGL_fillPolygonFast() scan converts a filled
  2184.                         convex polygon in the current color and
  2185.                         style. A        polygon is defined as a
  2186.                                  convex
  2187.                         polygon such that every horizontal line drawn
  2188.                         through the polygon would cross exactly two
  2189.                         active edges (neither horizontal lines nor
  2190.                         zero-length edges count as active edges; both
  2191.                         are acceptable anywhere in the polygon).
  2192.                         Right & left edges may cross (polygons may be
  2193.                         nonsimple). Attempting to scan convert a
  2194.                         polygon that does not fit this description
  2195.                         will produce unpredictable results.
  2196.  
  2197.                         This is the fastest method to render
  2198.                         polygonal shapes such as triangles and
  2199.                         quadrilaterals.
  2200.  
  2201.                         In order to ensure correct scan conversion of
  2202.                         polygons with shared vertices, the right and
  2203.                         bottom edges of the polygons are not scan
  2204.                         converted. All vertices are offset by
  2205.                         (xOffset,yOffset).
  2206.  
  2207.                         Note: You      call MGL_beginDrawing() before
  2208.                                   must
  2209.                         calling this routine, and you must call
  2210.                         MGL_endDrawing() after scan converting one or
  2211.                         more convex polygons. You may call other MGL
  2212.                         routines at the same time however.
  2213.  
  2214.             Return      True if the polygon was scan converted, false
  2215.             value       if an error occurred.
  2216.  
  2217.             See also    MGL_fillPolygon(), MGL_fillGouraudPolygon(),
  2218.                         MGL_beginDrawing(), MGL_endDrawing().
  2219.  
  2220.  
  2221.  
  2222.  
  2223.             Chapter 6 - Console Library                               33
  2224.  
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.             MGL_fillRect
  2231.  
  2232.             Function    Draws a filled rectangle.
  2233.  
  2234.             Syntax      void MGL_fillRect(rect r);
  2235.  
  2236.             Prototype   mgraph.h
  2237.             in
  2238.  
  2239.             Parameters  r - Rectangle to fill
  2240.  
  2241.             Remarks     MGL_fillRect() fills a rectangle in the
  2242.                         current current drawing attributes. The
  2243.                         mathematical definition of a rectangle does
  2244.                         not include the right and bottom endpoints,
  2245.                         so effectively the right and bottom endpoints
  2246.                         are not scan converted (solving problems with
  2247.                         shared vertices).
  2248.  
  2249.             See also    MGL_fillRectCoord(), MGL_fillRectPt().
  2250.  
  2251.  
  2252.             MGL_fillRectCoord
  2253.  
  2254.             Function    Draws a filled rectangle.
  2255.  
  2256.             Syntax      void MGL_fillRectCoord(int left,int top,int
  2257.                         right,int bottom);
  2258.  
  2259.             Prototype   mgraph.h
  2260.             in
  2261.  
  2262.             Parameters  left - Left edge of rectangle
  2263.                         top - Top egde of rectangle
  2264.                         right - Right edge of rectangle
  2265.                         bottom - Bottom edge of rectangle
  2266.  
  2267.             Remarks     MGL_fillRectCoord() fills a rectangle defined
  2268.                         by the coordinates of its edges in the
  2269.                         current current drawing attributes. The
  2270.                         mathematical definition of a rectangle does
  2271.                         not include the right and bottom endpoints,
  2272.                         so effectively the right and bottom endpoints
  2273.                         are not scan converted (solving problems with
  2274.                         shared vertices).
  2275.  
  2276.             See also    MGL_fillRect(), MGL_fillRectPt().
  2277.  
  2278.  
  2279.  
  2280.  
  2281.  
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.             34                      MegaGraph Graphics Library Reference
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.             MGL_fillRectPt
  2298.  
  2299.             Function    Draws a filled rectangle defined by two
  2300.                         points.
  2301.  
  2302.             Syntax      void MGL_fillRectPt(point lt,point rb);
  2303.  
  2304.             Prototype   mgraph.h
  2305.             in
  2306.  
  2307.             Parameters  lt - Point defining the left, top corner of
  2308.                         the rectangle
  2309.                         rb - Point defining the right, bottom corner
  2310.                         of rectangle.
  2311.  
  2312.             Remarks     MGL_fillRectPt() fills a rectangle defined by
  2313.                         two points in the current current drawing
  2314.                         attributes. The mathematical definition of a
  2315.                         rectangle does not include the right and
  2316.                         bottom endpoints, so effectively the right
  2317.                         and bottom endpoints are not scan converted
  2318.                         (solving problems with shared vertices).
  2319.  
  2320.             See also    MGL_fillRect(), MGL_fillRectCoord().
  2321.  
  2322.  
  2323.             MGL_getActivePage
  2324.  
  2325.             Function    Returns the currently active hardware page.
  2326.  
  2327.             Syntax      void MGL_getActivePage(void);
  2328.  
  2329.             Prototype   mgraph.h
  2330.             in
  2331.  
  2332.             Remarks     MGL_getActivePage() returns the currently
  2333.                         active hardware video page number. The first
  2334.                         hardware video page is number 0, the second
  2335.                         is 1 and so on. The number of available
  2336.                         hardware video pages depends on the type of
  2337.                         underlying hardware, the video mode
  2338.                         resolution and amount of video memory
  2339.                         installed. Thus not all video modes support
  2340.                         multiple hardware video pages,
  2341.  
  2342.             Return      Currently active hardware page.
  2343.             value
  2344.  
  2345.             See also    MGL_setActivePage(), MGL_getVisualPage(),
  2346.                         MGL_setVisualPage().
  2347.  
  2348.  
  2349.  
  2350.  
  2351.  
  2352.  
  2353.  
  2354.  
  2355.  
  2356.  
  2357.             Chapter 6 - Console Library                               35
  2358.  
  2359.  
  2360.  
  2361.  
  2362.  
  2363.  
  2364.             MGL_getArcCoords
  2365.  
  2366.             Function    Returns the starting and ending arc
  2367.                         coordinates.
  2368.  
  2369.             Syntax      void MGL_getArcCoords(arc_coords *coords);
  2370.  
  2371.             Prototype   mgraph.h
  2372.             in
  2373.  
  2374.             Parameters  coords - Pointer to structure to store
  2375.                         coordinates
  2376.  
  2377.             Remarks     MGL_getArcCoords() returns the centre
  2378.                         coordinate, and starting and ending points on
  2379.                         the ellipse that define the last elliptical
  2380.                         arc to be rendered. You can then use these
  2381.                         coordinate values to draw a line from the
  2382.                         centre of the ellipse to the starting and
  2383.                         ending points to complete the outline of the
  2384.                         elliptical wedge.
  2385.  
  2386.                         The coordinates are returned in the
  2387.                         arc_coords structure which is defined as:
  2388.  
  2389.                         typedef struct {
  2390.                             int     x,y;
  2391.                             int     startX,startY;
  2392.                             int     endX,endY;
  2393.                             } arc_coords;
  2394.  
  2395.                         where (x,y) defines the centre of the
  2396.                         ellipse, and (startX,startY) defines the
  2397.                         starting point on the ellipse and (endX,endY)
  2398.                         defines the ending point on the ellipse.
  2399.  
  2400.                         Note: This routine must be called immediately
  2401.                         after calling the MGL_ellipseArc() routines.
  2402.  
  2403.  
  2404.             MGL_getAspectRatio
  2405.  
  2406.             Function    Returns the current video mode aspect ratio.
  2407.  
  2408.             Syntax      int MGL_getAspectRatio(void);
  2409.  
  2410.             Prototype   mgraph.h
  2411.             in
  2412.  
  2413.  
  2414.  
  2415.  
  2416.  
  2417.  
  2418.  
  2419.  
  2420.  
  2421.  
  2422.  
  2423.  
  2424.             36                      MegaGraph Graphics Library Reference
  2425.  
  2426.  
  2427.  
  2428.  
  2429.  
  2430.  
  2431.             Remarks     MGL_getAspectRatio() returns the aspect ratio
  2432.                         of the currently active output device's
  2433.                         physical pixels. This ratio is equal to:
  2434.  
  2435.                                   pixel x size
  2436.                                           x 
  2437.                                           1000
  2438.                                   pixel y size
  2439.  
  2440.                         The device aspect ratio can be used to
  2441.                         display circles and squares on the display
  2442.                         device by approximating them with ellipses
  2443.                         and rectangles of the appropriate dimensions.
  2444.                         Thus in order to determine the number of
  2445.                         pixels in the y direction for a square with
  2446.                         100 pixels in the x direction, we can simply
  2447.                         use the formula:
  2448.  
  2449.                         y_pixels = ((long)x_pixels * 1000) /
  2450.                         aspectratio
  2451.  
  2452.                         Note the cast to a long to avoid arithmetic
  2453.                         overflow, as the apsect ratio is returned as
  2454.                         an integer value with 1000 being a 1:1 aspect
  2455.                         ratio.
  2456.  
  2457.             Return      Current video mode aspect ratio * 1000.
  2458.             value
  2459.  
  2460.             See also    MGL_setAspectRatio()
  2461.  
  2462.  
  2463.             MGL_getAttributes
  2464.  
  2465.             Function    Returns a copy of the current attribute list
  2466.  
  2467.             Syntax      void MGL_getAttributes(attributes *attr);
  2468.  
  2469.             Prototype   mgraph.h
  2470.             in
  2471.  
  2472.             Parameters  attr - Pointer to structure to store
  2473.                         attribute values in
  2474.  
  2475.  
  2476.  
  2477.  
  2478.  
  2479.  
  2480.  
  2481.  
  2482.  
  2483.  
  2484.  
  2485.  
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.             Chapter 6 - Console Library                               37
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.             Remarks     MGL_getAttributes() returns a copy of the
  2501.                         currently active attribute lists. You can use
  2502.                         this routine to save the state of the MGL and
  2503.                         later restore this state with the
  2504.                         MGL_restoreAttributes() routine. The
  2505.                         attribute values are returned in a structure
  2506.                         define as:
  2507.  
  2508.                         typedef struct {
  2509.                             color_t         color;
  2510.                             color_t         backColor;
  2511.                             int             markerSize;
  2512.                             marker_style    markerStyle;
  2513.                             color_t         markerColor;
  2514.                             color_t         bdr_bright;
  2515.                             color_t         bdr_dark;
  2516.                             point           CP;
  2517.                             write_mode      writeMode;
  2518.                             fill_style      penStyle;
  2519.                             int             penHeight;
  2520.                             int             penWidth;
  2521.                             pattern         penPat;
  2522.                             pixpattern      penPixPat;
  2523.                             rect            viewport;
  2524.                             rect            clipRect;
  2525.                             bool            clip;
  2526.                             int             poly_type;
  2527.                             text_settings   tsettings;
  2528.                             } attributes;
  2529.  
  2530.                         Note: This routine does not return any values
  2531.                         to do with the current viewport stack. This
  2532.                         will need to be maintained separately.
  2533.  
  2534.             See also    MGL_restoreAttributes()
  2535.  
  2536.  
  2537.             MGL_getBackColor
  2538.  
  2539.             Function    Returns the current background color value.
  2540.  
  2541.             Syntax      color_t MGL_getBackColor(void);
  2542.  
  2543.             Prototype   mgraph.h
  2544.             in
  2545.  
  2546.             Remarks     MGL_getBackColor() returns the current
  2547.                         background color value. The background color
  2548.                         value is used to clear the display and
  2549.                         viewport with the MGL_clearDevice() and
  2550.                         MGL_clearViewport() routines, and is also
  2551.                         used for filling solid primitives in the
  2552.                         BITMAP_PATTERN_OPAQUE fill mode.
  2553.  
  2554.             Return      Current background color value.
  2555.             value
  2556.  
  2557.  
  2558.  
  2559.  
  2560.             38                      MegaGraph Graphics Library Reference
  2561.  
  2562.  
  2563.  
  2564.  
  2565.  
  2566.  
  2567.             See also    MGL_setBackColor(), MGL_getColor(),
  2568.                         MGL_setColor()
  2569.  
  2570.  
  2571.             MGL_getBorderColors
  2572.  
  2573.             Function    Returns the current border color values.
  2574.  
  2575.             Syntax      void MGL_getBorderColors(color_t
  2576.                         *bright,color_t *dark);
  2577.  
  2578.             Prototype   mgraph.h
  2579.             in
  2580.  
  2581.             Parameters  bright - Place to store bright color value
  2582.                         dark - Place to store dark color value
  2583.  
  2584.             Remarks     MGL_getBorderColors() returns the currently
  2585.                         active border colors values. There are two
  2586.                         border color defined by the MGL, the bright
  2587.                         border color value and the      border color
  2588.                                                    dark
  2589.                         value. These values are used by the
  2590.                         MGL_drawBorder(), MGL_drawHDivider() and
  2591.                         MGL_drawVDivider() routines to determine the
  2592.                         colors to draw the psuedo 3D borders in.
  2593.                         These values will be set automatically for
  2594.                         you by default when the MGL is initialised,
  2595.                         but you will need to change these values if
  2596.                         you modify the palette.
  2597.  
  2598.             See also    MGL_setBorderColors(), MGL_drawBorder(),
  2599.                         MGL_drawHDivider(), MGL_drawVDivider()
  2600.  
  2601.  
  2602.             MGL_getCharMetrics
  2603.  
  2604.             Function    Computes the metrics for a specific
  2605.                         character.
  2606.  
  2607.             Syntax      void MGL_getCharMetrics(char ch,metrics
  2608.                         *metrics);
  2609.  
  2610.             Prototype   mgraph.h
  2611.             in
  2612.  
  2613.             Parameters  metrics - Place to store the resulting
  2614.                         metrics.
  2615.  
  2616.  
  2617.  
  2618.  
  2619.  
  2620.  
  2621.  
  2622.  
  2623.  
  2624.  
  2625.  
  2626.  
  2627.  
  2628.             Chapter 6 - Console Library                               39
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.             Remarks     MGL_getCharMetrics() computes the character
  2636.                         metrics for a specific character. The
  2637.                         character metrics define specific characters
  2638.                         width, height, asecent, descent and other
  2639.                         values. These values can then be used to
  2640.                         correctly position the character with pixel
  2641.                         precise positioning. The metrics are computed
  2642.                         and returned in the metrics structure defined
  2643.                         as:
  2644.  
  2645.                         typedef struct {
  2646.                             int             width;
  2647.                             int             fontWidth;
  2648.                             int             fontHeight;
  2649.                             int             ascent;
  2650.                             int             descent;
  2651.                             int             leading;
  2652.                             int             kern;
  2653.                             } metrics;
  2654.  
  2655.                         where width defines the actual width in
  2656.                         pixels for the character, fontWidth defines
  2657.                         the width of the character including any
  2658.                         extra padding between it and the next
  2659.                         character and kern defines the actual kern
  2660.                         value for the specific character. All the
  2661.                         other values will be the same as those for
  2662.                         the entire font file.
  2663.  
  2664.                         All values are defined in pixels and will be
  2665.                         as accurate as possible given the current
  2666.                         fonts scaling factor (currently only vector
  2667.                         fonts can be scaled).
  2668.  
  2669.             See also    MGL_getFontMetrics()
  2670.  
  2671.  
  2672.             MGL_getClipMode
  2673.  
  2674.             Function    Returns the current clipping mode.
  2675.  
  2676.             Syntax      bool MGL_getClipMode(void);
  2677.  
  2678.             Prototype   mgraph.h
  2679.             in
  2680.  
  2681.             Remarks     MGL_getClipMode() returns the current
  2682.                         clipping mode. You can selectively turn
  2683.                         clipping on and off for the MGL, in order to
  2684.                         speed up some operations. Clipping is turned
  2685.                         on by default, and generally you will want to
  2686.                         leave clipping enabled.
  2687.  
  2688.             Return      True if clipping is on, false if not.
  2689.             value
  2690.  
  2691.             See also    MGL_setClipMode(), MGL_getClipRect(),
  2692.                         MGL_setClipRect()
  2693.  
  2694.  
  2695.             40                      MegaGraph Graphics Library Reference
  2696.  
  2697.  
  2698.  
  2699.  
  2700.  
  2701.  
  2702.  
  2703.  
  2704.             MGL_getClipRect
  2705.  
  2706.             Function    Returns the current clipping rectangle.
  2707.  
  2708.             Syntax      void MGL_getClipRect(rect *clip);
  2709.  
  2710.             Prototype   mgraph.h
  2711.             in
  2712.  
  2713.             Parameters  clip - Place to store the current clipping
  2714.                         rectangle
  2715.  
  2716.             Remarks     MGL_getClipRect() returns the current
  2717.                         clipping rectangle coordinates. The current
  2718.                         clipping rectangle is used to clip all
  2719.                         output, and is always defined as being
  2720.                         relative to the currently active viewport The
  2721.                         clipping rectangle can be no larger than the
  2722.                         currently active viewport.
  2723.  
  2724.             See also    MGL_setClipRect, MGL_getClipMode(),
  2725.                         MGL_getClipMode().
  2726.  
  2727.  
  2728.             MGL_getColor
  2729.  
  2730.             Function    Returns the current foreground color.
  2731.  
  2732.             Syntax      color_t MGL_getColor(void);
  2733.  
  2734.             Prototype   mgraph.h
  2735.             in
  2736.  
  2737.             Remarks     MGL_getColor() returns the current foreground
  2738.                         color values. The foreground color value is
  2739.                         used to draw all primitives.
  2740.  
  2741.             Return      Current foreground color.
  2742.             value
  2743.  
  2744.             See also    MGL_setColor(), MGL_getBackColor(),
  2745.                         MGL_setBackColor()
  2746.  
  2747.  
  2748.             MGL_getCP
  2749.  
  2750.             Function    Returns the current position value.
  2751.  
  2752.             Syntax      void MGL_getCP(point* CP);
  2753.  
  2754.             Prototype   mgraph.h
  2755.             in
  2756.  
  2757.             Parameters  CP - place to store the current position
  2758.  
  2759.  
  2760.  
  2761.  
  2762.             Chapter 6 - Console Library                               41
  2763.  
  2764.  
  2765.  
  2766.  
  2767.  
  2768.  
  2769.             Remarks     MGL_getCP() returns the current position
  2770.                         (CP). The CP is the current graphics cursor
  2771.                         position, and is used by a number of routines
  2772.                         to determine where to being drawing output.
  2773.                         You can use the MGL_moveTo() routine to
  2774.                         directly move the CP to a new position.
  2775.  
  2776.             See also    MGL_moveTo(), MGL_moveRel(), MGL_lineTo(),
  2777.                         MGL_lineRel(), MGL_drawStr().
  2778.  
  2779.  
  2780.             MGL_getCursorColor
  2781.  
  2782.             Function    Returns the current mouse cursor color.
  2783.  
  2784.             Syntax      color_t MGL_getCursorColor(void);
  2785.  
  2786.             Prototype   mgraph.h
  2787.             in
  2788.  
  2789.             Remarks     MGL_getCursorColor() returns the currently
  2790.                         active mouse cursor color. The mouse cursor
  2791.                         color is used to determine what foreground
  2792.                         color is used to draw the mouse cursor in.
  2793.  
  2794.             Return      Current mouse cursor color value.
  2795.             value
  2796.  
  2797.             See also    MGL_setCursorColor()
  2798.  
  2799.  
  2800.             MGL_getDefaultPalette
  2801.  
  2802.             Function    Returns the default palette for video mode.
  2803.  
  2804.             Syntax      void MGL_getDefaultPalette(palette *pal);
  2805.  
  2806.             Prototype   mgraph.h
  2807.             in
  2808.  
  2809.             Parameters  pal - Place to store the default palette
  2810.                         values.
  2811.  
  2812.  
  2813.  
  2814.  
  2815.  
  2816.  
  2817.  
  2818.  
  2819.  
  2820.  
  2821.  
  2822.  
  2823.  
  2824.  
  2825.  
  2826.  
  2827.  
  2828.  
  2829.             42                      MegaGraph Graphics Library Reference
  2830.  
  2831.  
  2832.  
  2833.  
  2834.  
  2835.  
  2836.             Remarks     MGL_getDefaultPalette() returns a copy of the
  2837.                         default palette for the current video mode.
  2838.                         This can be used to reset the palette to the
  2839.                         original default values that the palette is
  2840.                         programmed with when the MGL is initialised.
  2841.  
  2842.                         The palette values are manipulated as arrays
  2843.                         of the         structure, defined as:
  2844.                                palette
  2845.  
  2846.                         typedef struct {
  2847.                             uchar   red;
  2848.                             uchar   green;
  2849.                             uchar   blue;
  2850.                             } palette;
  2851.  
  2852.                         where red, green and blue define the color
  2853.                         components for that entry. Each color
  2854.                         component is defined as an 8 bit value with a
  2855.                         range of 0-255.
  2856.  
  2857.             See also    MGL_setPalette(), MGL_getPalette()
  2858.  
  2859.  
  2860.             MGL_getDivot
  2861.  
  2862.             Function    Saves a divot of video memory in system RAM
  2863.  
  2864.             Syntax      void MGL_getDivot(rect r,void *divot)
  2865.  
  2866.             Prototype   mgraph.h
  2867.             in
  2868.  
  2869.             Parameters  r - Rectangle defining the divot to save
  2870.                         divot - Pointer to area to store video memory
  2871.                         in
  2872.  
  2873.             Remarks     MGL_getDivot() copies a block of video memory
  2874.                         from the current video page into system RAM.
  2875.                           divot
  2876.                         A       is defined as being a rectangular
  2877.                         area of video memory that you wish to save.
  2878.                         However when the divot is saved, it may also
  2879.                         save other data slightly outside of the
  2880.                         specified area in order to increase the speed
  2881.                         at which the divot can be saved and restored.
  2882.                         Thus the divot routines save and restore the
  2883.                         video memory in the fastest possible manner.
  2884.                         This can be used to store the video memory
  2885.                         behind pull down menus etc.
  2886.  
  2887.                         You must pre-allocate enough space to hold
  2888.                         the entire divot in system RAM. Use the
  2889.                         MGL_divotSize() routine to determine the size
  2890.                         of the memory block required to store the
  2891.                         divot.
  2892.  
  2893.             See also    MGL_putDivot(), MGL_divotSize()
  2894.  
  2895.  
  2896.  
  2897.  
  2898.             Chapter 6 - Console Library                               43
  2899.  
  2900.  
  2901.  
  2902.  
  2903.  
  2904.  
  2905.             MGL_getDivotCoord
  2906.  
  2907.             Function    Saves a divot of video memory into system RAM
  2908.  
  2909.             Syntax      void MGL_getDivotCoord(int left,int top,int
  2910.                         right,int bottom,void *divot);
  2911.  
  2912.             Prototype   mgraph.h
  2913.             in
  2914.  
  2915.             Parameters  left - Left edge of area to save
  2916.                         top - Top egde of area to save
  2917.                         right - Right edge of area to save
  2918.                         bottom - Bottom edge of area to save
  2919.                         divot - Pointer to area to store the video
  2920.                         memory in
  2921.  
  2922.             Remarks     MGL_getDivotCoord() copies a block of video
  2923.                         memory from the current video page into
  2924.                         system RAM. A divot is defined as being a
  2925.                         rectangular area of video memory that you
  2926.                         wish to save. However when the divot is
  2927.                         saved, it may also save other data slightly
  2928.                         outside of the specified area in order to
  2929.                         increase the speed at which the divot can be
  2930.                         saved and restored. Thus the divot routines
  2931.                         save and restore the video memory in the
  2932.                         fastest possible manner. This can be used to
  2933.                         store the video memory behind pull down menus
  2934.                         etc.
  2935.  
  2936.                         You must pre-allocate enough space to hold
  2937.                         the entire divot in system RAM. Use the
  2938.                         MGL_divotSize() routine to determine the size
  2939.                         of the memory block required to store the
  2940.                         divot.
  2941.  
  2942.             See also    MGL_getDivot(), MGL_putDivot(),
  2943.                         MGL_divotSize()
  2944.  
  2945.  
  2946.             MGL_getDriver
  2947.  
  2948.             Function    Returns the current video device driver id
  2949.  
  2950.             Syntax      int MGL_getDriver(void);
  2951.  
  2952.             Prototype   mgraph.h
  2953.             in
  2954.  
  2955.             Remarks     MGL_getDriver() returns the numerical id of
  2956.                         the currently active video device driver.
  2957.                         This value can be converted in a printable
  2958.                         representation with the MGL_driverName()
  2959.                         routine.
  2960.  
  2961.             Return      Current video device driver id.
  2962.             value
  2963.  
  2964.  
  2965.             44                      MegaGraph Graphics Library Reference
  2966.  
  2967.  
  2968.  
  2969.  
  2970.  
  2971.  
  2972.  
  2973.             See also    MGL_driverName(), MGL_getMode()
  2974.  
  2975.  
  2976.             MGL_getFont
  2977.  
  2978.             Function    Returns the currently active font.
  2979.  
  2980.             Syntax      font *MGL_getFont(void);
  2981.  
  2982.             Prototype   mgraph.h
  2983.             in
  2984.  
  2985.             Remarks     MGL_getFont() returns a pointer to the
  2986.                         currently active font. The currently active
  2987.                         font is used to perform all text output by
  2988.                         the MGL.
  2989.  
  2990.             Return      Pointer to currently active font.
  2991.             value
  2992.  
  2993.             See also    MGL_useFont(), MGL_loadFont(),
  2994.                         MGL_unloadFont()
  2995.  
  2996.  
  2997.             MGL_getFontMetrics
  2998.  
  2999.             Function    Returns the currently active font metrics.
  3000.  
  3001.             Syntax      void MGL_getFontMetrics(metrics *metrics);
  3002.  
  3003.             Prototype   mgraph.h
  3004.             in
  3005.  
  3006.             Parameters  metrics - Place to store the font metrics.
  3007.  
  3008.  
  3009.  
  3010.  
  3011.  
  3012.  
  3013.  
  3014.  
  3015.  
  3016.  
  3017.  
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027.  
  3028.  
  3029.  
  3030.  
  3031.  
  3032.             Chapter 6 - Console Library                               45
  3033.  
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.             Remarks     MGL_getFontMetrics() computes the font
  3040.                         metrics for the current font. The metrics are
  3041.                         computed and returned in the metrics
  3042.                         structure defined as:
  3043.  
  3044.                         typedef struct {
  3045.                             int             width;
  3046.                             int             fontWidth;
  3047.                             int             fontHeight;
  3048.                             int             ascent;
  3049.                             int             descent;
  3050.                             int             leading;
  3051.                             int             kern;
  3052.                             } metrics;
  3053.  
  3054.                         where width defines the maximum physical
  3055.                         width of all characters in the font,
  3056.                         fontWidth defines the maximum width of all
  3057.                         the characters in the font including any
  3058.                         extra padding between each character. The
  3059.                         fontWidth value of each character is used to
  3060.                         advance the CP to the start of the next
  3061.                         character, and can be larger than the actual
  3062.                         character width (in order to put space
  3063.                         between the characters). The ascent and
  3064.                         descent values define the values from the
  3065.                         baseline of the font to the highest and
  3066.                         lowest points of all characters. The leading
  3067.                         value defines the number of pixels between
  3068.                         each line of text, and the kern value defines
  3069.                         the maximum kerning value for the font (how
  3070.                         far certain characters can extend behind the
  3071.                         character start position).
  3072.  
  3073.                         All values are defined in pixels and will be
  3074.                         as accurate as possible given the current
  3075.                         fonts scaling factor (currently only vector
  3076.                         fonts can be scaled).
  3077.  
  3078.             See also    MGL_getCharMetrics().
  3079.  
  3080.  
  3081.             MGL_getImage
  3082.  
  3083.             Function    Copies of block of video memory to system
  3084.                         RAM.
  3085.  
  3086.             Syntax      void MGL_getImage(rect r,void *image)
  3087.  
  3088.             Prototype   mgraph.h
  3089.             in
  3090.  
  3091.             Parameters  r - Rectangle defining the image to save
  3092.                         image - Place to store the image data.
  3093.  
  3094.  
  3095.  
  3096.  
  3097.  
  3098.  
  3099.             46                      MegaGraph Graphics Library Reference
  3100.  
  3101.  
  3102.  
  3103.  
  3104.  
  3105.  
  3106.             Remarks     MGL_getImage() copies of block of video
  3107.                         memory into a system RAM buffer. The image
  3108.                         can then be modified in system RAM, and
  3109.                         restored to video RAM in another location.
  3110.                         MGL_getImage() is pixel exact so it only
  3111.                         copies the pixels that you specify, so it may
  3112.                         be slower than the MGL_getDivot() routine.
  3113.  
  3114.                         You must pre-allocate enough space to hold
  3115.                         the entire image in system RAM. Use the
  3116.                         MGL_imageSize() routine to determine the size
  3117.                         of the memory block required to store the
  3118.                         image.
  3119.  
  3120.             See also    MGL_getImageCoord(), MGL_putImage(),
  3121.                         MGL_putImageCoord(), MGL_imageSize().
  3122.  
  3123.  
  3124.             MGL_getImageCoord
  3125.  
  3126.             Function    Copies a block of video memory to system RAM.
  3127.  
  3128.             Syntax      void MGL_getImageCoord(int left,int top,int
  3129.                         right,int bottom,void *image);
  3130.  
  3131.             Prototype   mgraph.h
  3132.             in
  3133.  
  3134.             Parameters  left - Left edge of area to save
  3135.                         top - Top egde of area to save
  3136.                         right - Right edge of area to save
  3137.                         bottom - Bottom edge of area to save
  3138.                         image - Pointer to area to store the video
  3139.                         memory in
  3140.  
  3141.             Remarks     MGL_getImageCoord copies of block of video
  3142.                         memory into a system RAM buffer. The image
  3143.                         can then be modified in system RAM, and
  3144.                         restored to system RAM in another location.
  3145.                         MGL_getImageCoord is pixel exact so it only
  3146.                         copies the pixels that you specify, so it may
  3147.                         be slower than the MGL_getDivot() routine.
  3148.  
  3149.                         You must pre-allocate enough space to hold
  3150.                         the entire image in system RAM. Use the
  3151.                         MGL_imageSize() routine to determine the size
  3152.                         of the memory block required to store the
  3153.                         image.
  3154.  
  3155.             See also    MGL_getImage(), MGL_putImage(),
  3156.                         MGL_putImageCoord(), MGL_imageSize()
  3157.  
  3158.  
  3159.  
  3160.  
  3161.  
  3162.  
  3163.  
  3164.  
  3165.  
  3166.             Chapter 6 - Console Library                               47
  3167.  
  3168.  
  3169.  
  3170.  
  3171.  
  3172.  
  3173.             MGL_getMarkerColor
  3174.  
  3175.             Function    Returns the current marker color value.
  3176.  
  3177.             Syntax      color_t MGL_getMarkerColor(void);
  3178.  
  3179.             Prototype   mgraph.h
  3180.             in
  3181.  
  3182.             Remarks     MGL_getMarkerColor returns the current marker
  3183.                         color value. The marker color is used when
  3184.                         drawing markers with the MGL_marker()
  3185.                         routine.
  3186.  
  3187.             Return      Current marker color value.
  3188.             value
  3189.  
  3190.             See also    MGL_setMarkerColor(), MGL_marker(),
  3191.                         MGL_polyMarker()
  3192.  
  3193.  
  3194.             MGL_getMarkerSize
  3195.  
  3196.             Function    Returns the current marker size value
  3197.  
  3198.             Syntax      int MGL_getMarkerSize(void);
  3199.  
  3200.             Prototype   mgraph.h
  3201.             in
  3202.  
  3203.             Remarks     MGL_getMarkerSize() returns the current
  3204.                         marker size. The marker size is used to
  3205.                         determine how big to draw the markers that
  3206.                         are drawn with the MGL_marker() routine. The
  3207.                         size is defined as the dimension from the
  3208.                         middle of the marker to the edges, so the
  3209.                         actual dimensions of the marker will be twice
  3210.                         the maker size plus 1. If marker size of 1
  3211.                         will define a marker that is contained within
  3212.                         a rectangle 3 pixels wide.
  3213.  
  3214.             Return      Current marker size
  3215.             value
  3216.  
  3217.             See also    MGL_setMarkerSize(), MGL_setMarkerStyle(),
  3218.                         MGL_getMarkerStyle(), MGL_marker(),
  3219.                         MGL_polyMarker()
  3220.  
  3221.  
  3222.             MGL_getMarkerStyle
  3223.  
  3224.             Function    Returns the current marker style.
  3225.  
  3226.             Syntax      int MGL_getMarkerStyle(void);
  3227.  
  3228.             Prototype   mgraph.h
  3229.             in
  3230.  
  3231.  
  3232.  
  3233.             48                      MegaGraph Graphics Library Reference
  3234.  
  3235.  
  3236.  
  3237.  
  3238.  
  3239.  
  3240.             Remarks     MGL_getMarkerStyle() returns the current
  3241.                         marker style value. The marker style defines
  3242.                         the type of marker to be rendered. Currently
  3243.                         the MGL defines the following markers:
  3244.  
  3245.                         MARKER_SQUARE - A solid square
  3246.                         MARKER_CIRCLE - A solid circle
  3247.                         MARKER_X      - A cross made of two lines
  3248.  
  3249.             Return      Current marker style value.
  3250.             value
  3251.  
  3252.             See also    MGL_setMarkerSize(), MGL_getMarkerSize(),
  3253.                         MGL_setMarkerStyle(), MGL_marker(),
  3254.                         MGL_polyMarker()
  3255.  
  3256.  
  3257.             MGL_getMode
  3258.  
  3259.             Function    Returns the current video mode number.
  3260.  
  3261.             Syntax      int MGL_getMode(void);
  3262.  
  3263.             Prototype   mgraph.h
  3264.             in
  3265.  
  3266.             Remarks     MGL_getMode() returns the currently active
  3267.                         video mode number. This number can be
  3268.                         converted to a printable form using the
  3269.                         MGL_modeName() routine.
  3270.  
  3271.             Return      Current video mode number.
  3272.             value
  3273.  
  3274.             See also    MGL_init(), MGL_modeName()
  3275.  
  3276.  
  3277.             MGL_getPalette
  3278.  
  3279.             Function    Obtains the currently active palette values.
  3280.  
  3281.             Syntax      void MGL_getPalette(palette *pal,int
  3282.                         numColors,int startIndex);
  3283.  
  3284.             Prototype   mgraph.h
  3285.             in
  3286.  
  3287.             Parameters  pal - Place to store the retrieved values
  3288.                         numColors - Number of color values to
  3289.                         retrieve
  3290.                         startIndex - Starting palette index value to
  3291.                         retrieve
  3292.  
  3293.  
  3294.  
  3295.  
  3296.  
  3297.  
  3298.  
  3299.  
  3300.             Chapter 6 - Console Library                               49
  3301.  
  3302.  
  3303.  
  3304.  
  3305.  
  3306.  
  3307.             Remarks     MGL_getPalette() obtains part or all of the
  3308.                         currently active palette values and stores it
  3309.                         in the array pal. You can specify only a
  3310.                         subset of the palette values to be obtained
  3311.                         with the startIndex and numColors arguments.
  3312.  
  3313.                         Thus to save the entire palette in a 256
  3314.                         color video mode, you would use (assuming
  3315.                         enough space for the palette has been
  3316.                         allocated):
  3317.  
  3318.                             MGL_getPalette(pal,255,0);
  3319.  
  3320.                         or to get the top half of the palette you
  3321.                         would use:
  3322.  
  3323.                             MGL_getPalette(pal,128,128);
  3324.  
  3325.                         You should ensure that you have allocated
  3326.                         enough memory to hold all of the palette
  3327.                         values that you wish to read. You can use
  3328.                         MGL_getPaletteSize() to determine the size
  3329.                         required to save the entire palette.
  3330.  
  3331.             See also    MGL_getPaletteEntry(), MGL_setPalette(),
  3332.                         MGL_getDefaultPalette()
  3333.  
  3334.  
  3335.             MGL_getPaletteEntry
  3336.  
  3337.             Function    Returns the value of a single palette entry
  3338.  
  3339.             Syntax      void MGL_getPaletteEntry(int entry,uchar
  3340.                         *red,uchar *green,uchar *blue);
  3341.  
  3342.             Prototype   mgraph.h
  3343.             in
  3344.  
  3345.             Parameters  entry - Palette index to read
  3346.                         red - Place to store the red component
  3347.                         green - Place to store the green component
  3348.                         blue - Place to store the green component
  3349.  
  3350.             Remarks     MGL_getPaletteEntry() obtains the color
  3351.                         values of a single palette entry. If you wish
  3352.                         to obtain more than a single palette index
  3353.                         you should use the MGL_getPalette() routine
  3354.                         which is faster for multiple entries.
  3355.  
  3356.             See also    MGL_setPaletteEntry(), MGL_getPalette(),
  3357.                         MGL_setPalette()
  3358.  
  3359.  
  3360.  
  3361.  
  3362.  
  3363.  
  3364.  
  3365.  
  3366.  
  3367.             50                      MegaGraph Graphics Library Reference
  3368.  
  3369.  
  3370.  
  3371.  
  3372.  
  3373.  
  3374.             MGL_getPaletteSize
  3375.  
  3376.             Function    Returns the number of entries in the entire
  3377.                         palette
  3378.  
  3379.             Syntax      int MGL_getPaletteSize(void);
  3380.  
  3381.             Prototype   mgraph.h
  3382.             in
  3383.  
  3384.             Remarks     MGL_getPaletteSize() returns the number of
  3385.                         entries in the entire palette. You should use
  3386.                         this routine to determine the size of the
  3387.                         entire palette, as the palette is still
  3388.                         active even in HiColor and TrueColor video
  3389.                         modes (it is implemented in software rather
  3390.                         than hardware in these modes).
  3391.  
  3392.             Return      Number of entries in entire palette.
  3393.             value
  3394.  
  3395.             See also    MGL_getPalette()
  3396.  
  3397.  
  3398.             MGL_getPaletteSnowLevel
  3399.  
  3400.             Function    Returns the current palette snow level
  3401.  
  3402.             Syntax      int MGL_getPaletteSnowLevel(void);
  3403.  
  3404.             Prototype   mgraph.h
  3405.             in
  3406.  
  3407.             Remarks     MGL_getPaletteSnowLevel() returns the number
  3408.                         of palette entries that can be programmed
  3409.                         during a single vertical retrace before the
  3410.                         onset of snow. The MGL uses a reasonable
  3411.                         default of 100 entries per retrace, but you
  3412.                         may want to modify this on faster or slower
  3413.                         machines (this should be a user option).
  3414.  
  3415.             Return      Current palette snow level.
  3416.             value
  3417.  
  3418.             See also    MGL_setPaletteSnowLevel()
  3419.  
  3420.  
  3421.             MGL_getPenBitmapPattern
  3422.  
  3423.             Function    Returns the currently active bitmap pattern
  3424.  
  3425.             Syntax      void MGL_getPenBitmapPattern(pattern *pat);
  3426.  
  3427.             Prototype   mgraph.h
  3428.             in
  3429.  
  3430.             Parameters  pat - Place to store the bitmap pattern
  3431.  
  3432.  
  3433.  
  3434.             Chapter 6 - Console Library                               51
  3435.  
  3436.  
  3437.  
  3438.  
  3439.  
  3440.  
  3441.             Remarks     MGL_getPenBitmapPattern() returns a copy of
  3442.                         the currently active bitmap pattern used when
  3443.                         rendering patterned primitive in the
  3444.                         BITMAP_PATTERN_TRANSPARENT and
  3445.                         BITMAP_PATTERN_OPQAUE pen styles. A bitmap
  3446.                         pattern is defined as an 8 x 8 pixel bitmap
  3447.                         pattern stored as an array of 8 bytes.
  3448.  
  3449.                         When filling in the
  3450.                         BITMAP_PATTERN_TRANSPARENT mode, the
  3451.                         foreground color is used to fill in all
  3452.                         pixels in the bitmap pattern that are a 1.
  3453.                         Where the pixels in the bitmap pattern are a
  3454.                         0, the original background color is retained.
  3455.                         In the BITMAP_PATTERN_OPAQUE mode, the
  3456.                         background color is used to fill in the
  3457.                         pixels in the bitmap that are set to a 0.
  3458.  
  3459.             See also    MGL_setPenBitmapPattern(), MGL_setPenStyle(),
  3460.                         MGL_getPenStyle()
  3461.  
  3462.  
  3463.             MGL_getPenSize
  3464.  
  3465.             Function    Returns the current pen size.
  3466.  
  3467.             Syntax      void MGL_getPenSize(int *height,int *width);
  3468.  
  3469.             Prototype   mgraph.h
  3470.             in
  3471.  
  3472.             Parameters  height - Place to store the current pen
  3473.                         height
  3474.                         width - Place to store the current pen width
  3475.  
  3476.             Remarks     MGL_getPenSize() return the size of the
  3477.                         current pen in pixels. The default pen is 1
  3478.                         pixel by 1 pixel in dimensions, however you
  3479.                         can change this to whatever value you like.
  3480.                         When primitive are rendered with a pen other
  3481.                         than the default, the pixels in the pen
  3482.                         always lie to the right and below the current
  3483.                         pen position.
  3484.  
  3485.             See also    MGL_setPenSize()
  3486.  
  3487.  
  3488.             MGL_getPenStyle
  3489.  
  3490.             Function    Returns the current pen style.
  3491.  
  3492.             Syntax      int MGL_getPenStyle(void);
  3493.  
  3494.             Prototype   mgraph.h
  3495.             in
  3496.  
  3497.  
  3498.  
  3499.  
  3500.  
  3501.             52                      MegaGraph Graphics Library Reference
  3502.  
  3503.  
  3504.  
  3505.  
  3506.  
  3507.  
  3508.             Remarks     MGL_getPenStyle() returns the currently
  3509.                         active pen style. The MGL supports the
  3510.                         following pen styles:
  3511.  
  3512.                         SOLID_PATTERN              - Fill with solid
  3513.                         color
  3514.                         BITMAP_PATTERN_OPAQUE      - Pattern fill
  3515.                         BITMAP_PATTERN_TRANSPARENT - Transparent
  3516.                         pattern fill
  3517.  
  3518.                         When filling in the
  3519.                         BITMAP_PATTERN_TRANSPARENT mode, the
  3520.                         foreground color is used to fill in all
  3521.                         pixels in the bitmap pattern that are a 1.
  3522.                         Where the pixels in the bitmap pattern are a
  3523.                         0, the original background color is retained.
  3524.                         In the BITMAP_PATTERN_OPAQUE mode, the
  3525.                         background color is used to fill in the
  3526.                         pixels in the bitmap that are set to a 0.
  3527.  
  3528.             Return      Current pen style.
  3529.             value
  3530.  
  3531.             See also    MGL_setPenStyle(), MGL_setPenBitmapPattern()
  3532.  
  3533.  
  3534.             MGL_getPixel
  3535.  
  3536.             Function    Returns the color of a specified pixel
  3537.  
  3538.             Syntax      color_t MGL_getPixel(point p)
  3539.  
  3540.             Prototype   mgraph.h
  3541.             in
  3542.  
  3543.             Parameters  p - Point defining the pixel to read
  3544.  
  3545.             Remarks     MGL_getPixel() returns the color of the pixel
  3546.                         at the coordinates defined by the point  .
  3547.                                                                 p
  3548.  
  3549.                         Note: You must ensure that you call the
  3550.                         routine MGL_beginPixel() before reading any
  3551.                         pixel values and the routine MGL_endPixel()
  3552.                         after reading a bunch of pixels.
  3553.  
  3554.             Return      Color of the specified pixel.
  3555.             value
  3556.  
  3557.             See also    MGL_pixel(), MGL_getPixelCoord(),
  3558.                         MGL_beginPixel(), MGL_endPixel()
  3559.  
  3560.  
  3561.  
  3562.  
  3563.  
  3564.  
  3565.  
  3566.  
  3567.  
  3568.  
  3569.             Chapter 6 - Console Library                               53
  3570.  
  3571.  
  3572.  
  3573.  
  3574.  
  3575.  
  3576.             MGL_getPixelCoord
  3577.  
  3578.             Function    Returns the color of a specified pixel
  3579.  
  3580.             Syntax      color_t MGL_getPixelCoord(int x,int y);
  3581.  
  3582.             Prototype   mgraph.h
  3583.             in
  3584.  
  3585.             Parameters  x,y - Coordinates of the pixel to read.
  3586.  
  3587.             Remarks     MGL_getPixelCoord() returns the color of the
  3588.                         pixel at the coordinates defined by the point
  3589.                              .
  3590.                         (x,y)
  3591.  
  3592.                         Note: You      ensure that you call the
  3593.                                   must
  3594.                         routine MGL_beginPixel() before reading any
  3595.                         pixel values and the routine MGL_endPixel()
  3596.                         after reading a bunch of pixels.
  3597.  
  3598.             Return      Color of the specified pixel.
  3599.             value
  3600.  
  3601.             See also    MGL_pixel(), MGL_getPixel(),
  3602.                         MGL_beginPixel(), MGL_endPixel()
  3603.  
  3604.  
  3605.             MGL_getPixelFormat
  3606.  
  3607.             Function    Returns the current packed pixel format
  3608.                         information.
  3609.  
  3610.             Syntax      void MGL_getPixelFormat(pixel_format
  3611.                         *format);
  3612.  
  3613.             Prototype   mgraph.h
  3614.             in
  3615.  
  3616.             Parameters  format - Place to store the pixel format
  3617.                         information.
  3618.  
  3619.  
  3620.  
  3621.  
  3622.  
  3623.  
  3624.  
  3625.  
  3626.  
  3627.  
  3628.  
  3629.  
  3630.  
  3631.  
  3632.  
  3633.  
  3634.  
  3635.  
  3636.  
  3637.  
  3638.             54                      MegaGraph Graphics Library Reference
  3639.  
  3640.  
  3641.  
  3642.  
  3643.  
  3644.  
  3645.             Remarks     MGL_getPixelFormat() returns the current
  3646.                         pixel format information for the currently
  3647.                         active video mode. This information is used
  3648.                         by the MGL to encode the packed pixel
  3649.                         information, and can be used by your
  3650.                         application to work out how to pack values
  3651.                         correctly for the direct color video modes.
  3652.                         This routine should also be used to correctly
  3653.                         interpret the format of the pixel information
  3654.                         returned by the MGL_getImage() routine. The
  3655.                         pixel format structure is defined as follows:
  3656.  
  3657.                         typedef struct {
  3658.                             char    redMask,blueMask;
  3659.                             char    greenMask,rsvdMask;
  3660.                             int     redPos,redAdjust;
  3661.                             int     greenPos,greenAdjust;
  3662.                             int     bluePos,blueAdjust;
  3663.                             int     rsvdPos,rsvdAdjust;
  3664.                             } pixel_format;
  3665.  
  3666.                         The Mask values are logical AND masks that
  3667.                         can be used to represent the correct number
  3668.                         of usable bits in each color value. The Pos
  3669.                         values describe where in the packed pixel
  3670.                         format each value resides, and the Adjust
  3671.                         values descibe the bit shift required to
  3672.                         adjust to 8 bit component values. The
  3673.                         following code illustrates how these values
  3674.                         can be used to unpack values to and from 8
  3675.                         bit RGB tuples:
  3676.  
  3677.                         R = (((color) >> redPos) & redMask) <<
  3678.                         redAdjust;
  3679.                         G = (((color) >> greenPos) & greenMask) <<
  3680.                         greenAdjust;
  3681.                         B = (((color) >> bluePos) & blueMask) <<
  3682.                         blueAdjust;
  3683.  
  3684.                         and to pack values:
  3685.  
  3686.                         color = ((color_t)((R >> redAdjust) &
  3687.                         redMask) << redPos)
  3688.                          | ((color_t)((G >> greenAdjust) & greenMask)
  3689.                         << greenPos)
  3690.                          | ((color_t)((B >> blueAdjust) & blueMask)
  3691.                         << bluePos);
  3692.  
  3693.             See also    MGL_packColor(), MGL_unpackColor()
  3694.  
  3695.  
  3696.  
  3697.  
  3698.  
  3699.  
  3700.  
  3701.  
  3702.  
  3703.  
  3704.  
  3705.             Chapter 6 - Console Library                               55
  3706.  
  3707.  
  3708.  
  3709.  
  3710.  
  3711.  
  3712.             MGL_getPolygonType
  3713.  
  3714.             Function    Returns the current polygon type.
  3715.  
  3716.             Syntax      int MGL_getPolygonType(void);
  3717.  
  3718.             Prototype   mgraph.h
  3719.             in
  3720.  
  3721.             Remarks     MGL_getPolygonType() returns the current
  3722.                         polygon type. You can change this value with
  3723.                         the MGL_setPolygonType() to force the MGL to
  3724.                         work with a specific polygon type (and to
  3725.                         avoid the default automatic polygon type
  3726.                         checking). The MGL supports the following
  3727.                         polygon types:
  3728.  
  3729.                         AUTO_POLYGON    - MGL automatically
  3730.                         determines type
  3731.                         CONVEX_POLYGON  - All polygons rendered as
  3732.                         convex
  3733.                         COMPLEX_POLYGON - All polygons rendered as
  3734.                         complex
  3735.  
  3736.                         If you expect to be drawing lots of complex
  3737.                         or convex polygons, setting the polygon type
  3738.                         can result in faster polygon rendering.
  3739.  
  3740.             Return      Current polygon type code.
  3741.             value
  3742.  
  3743.             See also    MGL_setPolygonType(), MGL_fillPolygon()
  3744.  
  3745.  
  3746.             MGL_getSpaceExtra
  3747.  
  3748.             Function    Returns the current space extra value.
  3749.  
  3750.             Syntax      int MGL_getSpaceExtra(void);
  3751.  
  3752.             Prototype   mgraph.h
  3753.             in
  3754.  
  3755.             Remarks     MGL_getSpaceExtra() returns the current space
  3756.                         extra value used when drawing text in the
  3757.                         current font. The space extra value is
  3758.                         normally zero, but can be a positive or
  3759.                         negative value. This value can be used to
  3760.                         insert extra space between the characters in
  3761.                         a font (making this value a large negative
  3762.                         value will make the characters run on top of
  3763.                         each other).
  3764.  
  3765.             Return      Current space extra value.
  3766.             value
  3767.  
  3768.             See also    MGL_setSpaceExtra(), MGL_drawStr()
  3769.  
  3770.  
  3771.  
  3772.             56                      MegaGraph Graphics Library Reference
  3773.  
  3774.  
  3775.  
  3776.  
  3777.  
  3778.  
  3779.             MGL_getTextDirection
  3780.  
  3781.             Function    Returns the current text direction
  3782.  
  3783.             Syntax      int MGL_getTextDirection(void);
  3784.  
  3785.             Prototype   mgraph.h
  3786.             in
  3787.  
  3788.             Remarks     MGL_getTextDirection() returns the current
  3789.                         text direction. The MGL supports the
  3790.                         following text directions:
  3791.  
  3792.                         LEFT_DIR  - Text runs to the left (right to
  3793.                         left)
  3794.                         UP_DIR    - Text runs in the up direction
  3795.                         RIGHT_DIR - Text runs to the right (left to
  3796.                         right)
  3797.                         DOWN_DIR  - Text runs in the down direction
  3798.  
  3799.                         Currently the MGL only supports directional
  3800.                         text with the default 8x8 bitmap font and
  3801.                         vector fonts. Bitmap fonts can only be drawn
  3802.                         in the RIGHT_DIR direction.
  3803.  
  3804.             Return      Current text direction.
  3805.             value
  3806.  
  3807.             See also    MGL_setTextDirection(), MGL_drawStr()
  3808.  
  3809.  
  3810.             MGL_getTextJustify
  3811.  
  3812.             Function    Returns the current text justification.
  3813.  
  3814.             Syntax      void MGL_getTextJustify(int *horiz,int
  3815.                         *vert);
  3816.  
  3817.             Prototype   mgraph.h
  3818.             in
  3819.  
  3820.             Parameters  horiz - Place to store horizontal
  3821.                         justification
  3822.                         vert - Place to store vertical justification
  3823.  
  3824.  
  3825.  
  3826.  
  3827.  
  3828.  
  3829.  
  3830.  
  3831.  
  3832.  
  3833.  
  3834.  
  3835.  
  3836.  
  3837.  
  3838.  
  3839.             Chapter 6 - Console Library                               57
  3840.  
  3841.  
  3842.  
  3843.  
  3844.  
  3845.  
  3846.             Remarks     MGL_getTextJustify() returns the current text
  3847.                         justification values. The MGL support the
  3848.                         following horizontal justification types:
  3849.  
  3850.                         LEFT_TEXT     - Text is left justified
  3851.                         CENTER_TEXT   - Text is centered left to
  3852.                         right
  3853.                         RIGHT_TEXT    - Text is right justified
  3854.  
  3855.                         and the following vertical justification
  3856.                         types:
  3857.  
  3858.                         TOP_TEXT      - Text is top justified
  3859.                         CENTER_TEXT   - Text is centered top to
  3860.                         bottom
  3861.                         BASELINE_TEXT - Text is justified to the
  3862.                         baseline
  3863.                         BOTTOM_TEXT   - Text is bottom justified
  3864.  
  3865.             See also    MGL_setTextJustify()
  3866.  
  3867.  
  3868.             MGL_getTextSettings
  3869.  
  3870.             Function    Returns the current text settings.
  3871.  
  3872.             Syntax      void MGL_getTextSettings(text_settings
  3873.                         *settings);
  3874.  
  3875.             Prototype   mgraph.h
  3876.             in
  3877.  
  3878.             Parameters  settings - Place to store the current text
  3879.                         settings
  3880.  
  3881.  
  3882.  
  3883.  
  3884.  
  3885.  
  3886.  
  3887.  
  3888.  
  3889.  
  3890.  
  3891.  
  3892.  
  3893.  
  3894.  
  3895.  
  3896.  
  3897.  
  3898.  
  3899.  
  3900.  
  3901.  
  3902.  
  3903.  
  3904.  
  3905.  
  3906.             58                      MegaGraph Graphics Library Reference
  3907.  
  3908.  
  3909.  
  3910.  
  3911.  
  3912.  
  3913.             Remarks     MGL_getTextSettings() returns the currently
  3914.                         active text settings. This routine provides a
  3915.                         way to save and restore all the values
  3916.                         relating to the rendering of text in the MGL
  3917.                         with a single function call. The text
  3918.                         settings values are stored in the following
  3919.                         structure:
  3920.  
  3921.                         typedef struct {
  3922.                             int             horiz_just;
  3923.                             int             vert_just;
  3924.                             int             dir;
  3925.                             int             sz_numerx;
  3926.                             int             sz_numery;
  3927.                             int             sz_denomx;
  3928.                             int             sz_denomy;
  3929.                             int             space_extra;
  3930.                             font            *fnt;
  3931.  
  3932.                         where horiz_just     vert_just
  3933.                                          and           define the
  3934.                         horizontal and vertical justification values,
  3935.                             defines the current text direction,
  3936.                         dir
  3937.                         space_extra defines the current space extra
  3938.                         value and fnt define the currently active
  3939.                         font (stored in system memory). The
  3940.                         sz_numerx, sz_numery, sz_demonx and sz_denomy
  3941.                         specify the current text scaling factors.
  3942.  
  3943.             See also    MGL_setTextSettings
  3944.  
  3945.  
  3946.             MGL_getTextSize
  3947.  
  3948.             Function    Returns the current text scaling factors
  3949.  
  3950.             Syntax      void MGL_getTextSize(int *numerx,int
  3951.                         *denomx,int *numery,int *denomy);
  3952.  
  3953.             Prototype   mgraph.h
  3954.             in
  3955.  
  3956.             Parameters  numerx - Place to store the x numerator value
  3957.                         denomx - Place to store the x denominator
  3958.                         value
  3959.                         numery - Place to store the y numerator value
  3960.                         denomy - Place to store the y denominator
  3961.                         value
  3962.  
  3963.  
  3964.  
  3965.  
  3966.  
  3967.  
  3968.  
  3969.  
  3970.  
  3971.  
  3972.  
  3973.  
  3974.  
  3975.             Chapter 6 - Console Library                               59
  3976.  
  3977.  
  3978.  
  3979.  
  3980.  
  3981.  
  3982.             Remarks     MGL_getTextSize() returns the current text
  3983.                         scaling factors used by the MGL. The text
  3984.                         size values define an integer scaling factor
  3985.                         to be used, where the actual values will be
  3986.                         computed using the following formula:
  3987.  
  3988.                                   scaled
  3989.                                        unscaled
  3990.                                              numer
  3991.                                           denom
  3992.  
  3993.                         Note: Currently the MGL can only scale
  3994.                         vectors fonts.
  3995.  
  3996.             See also    MGL_setTextSize()
  3997.  
  3998.  
  3999.             MGL_getViewport
  4000.  
  4001.             Function    Returns the currently active viewport
  4002.  
  4003.             Syntax      void MGL_getViewport(rect *view);
  4004.  
  4005.             Prototype   mgraph.h
  4006.             in
  4007.  
  4008.             Parameters  view - Place to store the current viewport
  4009.  
  4010.             Remarks     MGL_getViewport() returns the dimensions of
  4011.                         the currently active viewport. These
  4012.                         dimensions are global to the entire display
  4013.                         area used by the currently active video
  4014.                         device driver.
  4015.  
  4016.                         All output in the MGL is relative to the
  4017.                         current viewport, so by changing the viewport
  4018.                         to a new value you can make all output appear
  4019.                         in a different rectangular portion of the
  4020.                         video display.
  4021.  
  4022.             See also    MGL_setViewport(), MGL_setRelViewport(),
  4023.                         MGL_clearViewport(), MGL_setClipRect()
  4024.  
  4025.  
  4026.             MGL_getVisualPage
  4027.  
  4028.             Function    Returns the currently visible hardware video
  4029.                         page.
  4030.  
  4031.             Syntax      int MGL_getVisualPage(void);
  4032.  
  4033.             Prototype   mgraph.h
  4034.             in
  4035.  
  4036.  
  4037.  
  4038.  
  4039.  
  4040.  
  4041.  
  4042.  
  4043.  
  4044.             60                      MegaGraph Graphics Library Reference
  4045.  
  4046.  
  4047.  
  4048.  
  4049.  
  4050.  
  4051.             Remarks     MGL_getVisualPage() returns the currently
  4052.                         visible hardware video page number. The first
  4053.                         hardware video page is number 0, the second
  4054.                         is 1 and so on. The number of available
  4055.                         hardware video pages depends on the type of
  4056.                         underlying hardware, the video mode
  4057.                         resolution and amount of video memory
  4058.                         installed. Thus not all video modes support
  4059.                         multiple hardware video pages.
  4060.  
  4061.             Return      Currently visible hardware video page.
  4062.             value
  4063.  
  4064.             See also    MGL_setVisualPage(), MGL_getActivePage(),
  4065.                         MGL_setActivePage().
  4066.  
  4067.  
  4068.             MGL_getWriteMode
  4069.  
  4070.             Function    Returns the current write mode operation
  4071.  
  4072.             Syntax      int MGL_getWriteMode(void);
  4073.  
  4074.             Prototype   mgraph.h
  4075.             in
  4076.  
  4077.             Remarks     MGL_getWriteMode() returns the currently
  4078.                         active write mode. The MGL supports the
  4079.                         following write mode operations for all
  4080.                         output primitives:
  4081.  
  4082.                         REPLACE_MODE - Replace the original pixels
  4083.                         AND_MODE     - Logical AND with original
  4084.                         pixels
  4085.                         OR_MODE      - Logical OR with original
  4086.                         pixels
  4087.                         XOR_MODE     - Logical XOR with original
  4088.                         pixels
  4089.  
  4090.             Return      Current write mode operation.
  4091.             value
  4092.  
  4093.             See also    MGL_setWriteMode()
  4094.  
  4095.  
  4096.             MGL_getX
  4097.  
  4098.             Function    Returns the X coordinate of the current
  4099.                         position.
  4100.  
  4101.             Syntax      int MGL_getX(void);
  4102.  
  4103.             Prototype   mgraph.h
  4104.             in
  4105.  
  4106.  
  4107.  
  4108.  
  4109.  
  4110.  
  4111.             Chapter 6 - Console Library                               61
  4112.  
  4113.  
  4114.  
  4115.  
  4116.  
  4117.  
  4118.             Remarks     MGL_getX() returns the X coordinate of the
  4119.                         current position (CP) value. The CP is the
  4120.                         current graphics cursor position, and is used
  4121.                         by a number of output routines to determine
  4122.                         where to being drawing.
  4123.  
  4124.             Return      X coordinate of current position
  4125.             value
  4126.  
  4127.             See also    MGL_getY(), MGL_getCP(), MGL_moveTo()
  4128.  
  4129.  
  4130.             MGL_getY
  4131.  
  4132.             Function    Returns the Y coordinate of the current
  4133.                         position.
  4134.  
  4135.             Syntax      int MGL_getY(void);
  4136.  
  4137.             Prototype   mgraph.h
  4138.             in
  4139.  
  4140.             Remarks     MGL_getY() returns the Y coordinate of the
  4141.                         current position (CP) value. The CP is the
  4142.                         current graphics cursor position, and is used
  4143.                         by a number of output routines to determine
  4144.                         where to being drawing.
  4145.  
  4146.             Return      Y coordinate of current position
  4147.             value
  4148.  
  4149.             See also    MGL_getX(), MGL_getCP(), MGL_moveTo()
  4150.  
  4151.  
  4152.             MGL_globalToLocal
  4153.  
  4154.             Function    Converts a point from global coordinates to
  4155.                         local coordinates
  4156.  
  4157.             Syntax      void MGL_globalToLocal(point *p);
  4158.  
  4159.             Prototype   mgraph.h
  4160.             in
  4161.  
  4162.             Parameters  p - Pointer to point to be converted
  4163.  
  4164.             Remarks     MGL_globalToLocal() converts a coordinate
  4165.                         from global coordinates to local coordinates.
  4166.                         Global coordinates are defined relative to
  4167.                         the entire output devices display, while
  4168.                         local coordinates are relative to the
  4169.                         currently active viewport.
  4170.  
  4171.                         This routine is usually used to convert mouse
  4172.                         coordinate values from global screen
  4173.                         coordinates to the local coordinate system of
  4174.                         the currently active viewport.
  4175.  
  4176.  
  4177.  
  4178.             62                      MegaGraph Graphics Library Reference
  4179.  
  4180.  
  4181.  
  4182.  
  4183.  
  4184.  
  4185.             See also    MGL_localToGlobal()
  4186.  
  4187.  
  4188.             MGL_gouraudScanLine
  4189.  
  4190.             Function    Draws a smooth shaded scanline.
  4191.  
  4192.             Syntax      void MGL_gouraudScanLine(int y,int x1,int
  4193.                         x2,color_t c1,color_t c2);
  4194.  
  4195.             Prototype   mgraph.h
  4196.             in
  4197.  
  4198.             Parameters  y - Y coordinate of scanline
  4199.                         x1 - Starting X coordinate of scanline
  4200.                         x2 - Ending X coordinate of scanline
  4201.                         c1 - Starting color value
  4202.                         c2 - Ending color value
  4203.  
  4204.             Remarks     MGL_gouraudScanLine() draws a smooth shaded
  4205.                         scanline between the point        and the
  4206.                                                    (x1,y)
  4207.                         point       . The color values are smoothly
  4208.                               (x2,y)
  4209.                         interpolated across the scanline starting
  4210.                              c1
  4211.                         with    and ending with c2.
  4212.  
  4213.                         Note: You      call MGL_beginGouraud() before
  4214.                                   must
  4215.                         calling this routine to ensure that the
  4216.                         hardware is in the correct state to draws
  4217.                         shaded scanlines. You must also ensure that
  4218.                         you call MGL_endGouraud() after rendering a
  4219.                         set of shaded scanlines. You may not call any
  4220.                         other MGL routines while you are rendering
  4221.                         shaded scanlines.
  4222.  
  4223.             See also    MGL_fillGouraudPolygon(). MGL_beginGouraud(),
  4224.                         MGL_endGouraud()
  4225.  
  4226.  
  4227.             MGL_imageSize
  4228.  
  4229.             Function    Returns the number of bytes required to store
  4230.                         an image.
  4231.  
  4232.             Syntax      long MGL_imageSize(rect r);
  4233.  
  4234.             Prototype   mgraph.h
  4235.             in
  4236.  
  4237.             Parameters  r - Rectangle defining the size of the image
  4238.  
  4239.             Remarks     MGL_imageSize() returns the number of bytes
  4240.                         required to store an offscreen video memory
  4241.                         image. You must use this routine to allocate
  4242.                         enough memory to store the image before you
  4243.                         call the MGL_getImage() routine to read an
  4244.                         image
  4245.                         from display memory.
  4246.  
  4247.  
  4248.  
  4249.             Chapter 6 - Console Library                               63
  4250.  
  4251.  
  4252.  
  4253.  
  4254.  
  4255.  
  4256.             Return      Number of bytes required to store the image.
  4257.             value
  4258.  
  4259.             See also    MGL_imageSizeCoord(), MGL_getImage(),
  4260.                         MGL_getImageCoord(), MGL_putImage(),
  4261.                         MGL_putImageCoord().
  4262.  
  4263.             See also    MGL_fillGouraudPolygon(). MGL_beginGouraud(),
  4264.                         MGL_endGouraud()
  4265.  
  4266.  
  4267.             MGL_imageSizeCoord
  4268.  
  4269.             Function    Returns the number of bytes required to store
  4270.                         an image.
  4271.  
  4272.             Syntax      long MGL_imageSizeCoord(int left,int top,int
  4273.                         right,int bottom);
  4274.  
  4275.             Prototype   mgraph.h
  4276.             in
  4277.  
  4278.             Parameters  left - Left edge of area to save
  4279.                         top - Top egde of area to save
  4280.                         right - Right edge of area to save
  4281.                         bottom - Bottom edge of area to save
  4282.  
  4283.             Remarks     MGL_imageSize() returns the number of bytes
  4284.                         required to store an offscreen video memory
  4285.                         image. You must use this routine to allocate
  4286.                         enough memory to store the image before you
  4287.                         call the MGL_getImage() routine to read an
  4288.                         image
  4289.                         from display memory.
  4290.  
  4291.             Return      Number of bytes required to store the image.
  4292.             value
  4293.  
  4294.             See also    MGL_imageSize(), MGL_getImage(),
  4295.                         MGL_getImageCoord(), MGL_putImage(),
  4296.                         MGL_putImageCoord().
  4297.  
  4298.  
  4299.  
  4300.  
  4301.  
  4302.  
  4303.  
  4304.  
  4305.  
  4306.  
  4307.  
  4308.  
  4309.  
  4310.  
  4311.  
  4312.  
  4313.  
  4314.  
  4315.  
  4316.             64                      MegaGraph Graphics Library Reference
  4317.  
  4318.  
  4319.  
  4320.  
  4321.  
  4322.  
  4323.             MGL_init
  4324.  
  4325.             Function    Initialises the MGL.
  4326.  
  4327.             Syntax      void MGL_init(int *graphdriver,int
  4328.                         *graphmode,const char *pathtodriver);
  4329.  
  4330.             Prototype   mgraph.h
  4331.             in
  4332.  
  4333.             Parameters  graphdriver - Place to store detected
  4334.                         graphics device driver id
  4335.                         graphmode - Place to store suggested graphics
  4336.                         mode id
  4337.                         pathtodriver - Path to MGL driver files
  4338.  
  4339.             Remarks     MGL_init() initialises the MGL, sets the
  4340.                         specified video mode and clears the display
  4341.                         device ready to accept output. If you pass
  4342.                         the value grDETECT in the graphdriver
  4343.                         parameter, MGL_init() will automatically call
  4344.                         the MGL_detectGraph() routine to detect the
  4345.                         installed video device driver, and initialise
  4346.                         itself accordingly. The video mode used in
  4347.                         this case will be the one suggested by the
  4348.                         installed video device driver, and will be
  4349.                         returned in the           parameter. If a
  4350.                                         graphmode
  4351.                         suitable device is not found for use by the
  4352.                         MGL, it will return an error via the
  4353.                         MGL_result() routine and pass back the value
  4354.                         grNONE in the graphdriver parameter.
  4355.  
  4356.                         If you wish to start a video mode other than
  4357.                         the default one suggested by the video device
  4358.                         driver, you should call the MGL_detectGraph()
  4359.                         routine yourself, and pass the value returned
  4360.                             graphdriver
  4361.                         for             and your selected video mode
  4362.                            graphmode
  4363.                         in           to initialise the mode.
  4364.  
  4365.                         The video device drivers currently supported
  4366.                         by the MGL are (this is subject to change -
  4367.                         please consult the MGRAPH.H header file for
  4368.                         the latest information):
  4369.  
  4370.                         grDETECT  - Auto detect the graphics
  4371.                         subsystem
  4372.                         grNONE    - No graphics hardware detected
  4373.                         grEGA     - Standard EGA with 256k RAM
  4374.                         grVGA     - Standard VGA
  4375.                         grSVGA    - VESA VBE compliant Super VGA
  4376.                         grSVGA_S3 - S3 accelerated SuperVGA
  4377.  
  4378.                         The MGL supports a number of different video
  4379.                         mode resolutions, ranging from 320x200 up to
  4380.                         1280x1024 with color ranges from 16 colors up
  4381.                         to 16.7 million colors. The name for each
  4382.                         video mode can be constructed from the pixel
  4383.                         and color resolutions, so the video mode id
  4384.                         for 320x200 16 color EGA graphics mode is
  4385.                         grEGA_320x200x16, and the 1280x1024 16.7
  4386.             Chapter 6 - Console Library
  4387.                         million color mode is grSVGA_1280x1024x16m.   65
  4388.                         Please consult the MGRAPH.H header file for a
  4389.                         full list of defined video modes (subject to
  4390.                         change over time).
  4391.  
  4392.  
  4393.  
  4394.  
  4395.  
  4396.  
  4397.  
  4398.             See also    MGL_detectGraph(), MGL_setGraphMode(),
  4399.                         MGL_restoreCRTMode(), MGL_result()
  4400.  
  4401.  
  4402.             MGL_insetRect
  4403.  
  4404.             Function    Inset a rectangle by specified values.
  4405.  
  4406.             Syntax      void MGL_insetRect(rect r,int dx,int dy)
  4407.  
  4408.             Prototype   mgraph.h
  4409.             in
  4410.  
  4411.             Parameters  r - Rectangle to inset
  4412.                         dx - Value to inset the X coordinates by
  4413.                         dy - Value to inset the Y coordinates by
  4414.  
  4415.             Remarks     MGL_insetRect() insets the coordinates of a
  4416.                         rectangle by the specified amount in each
  4417.                         coordinate direction. The value of dx is
  4418.                         added to the left coordinate and subtracted
  4419.                         from the right coordinate, while the value of
  4420.                            is added to the top coordinate and
  4421.                         dy
  4422.                         subtracted from the bottom coordinate. You
  4423.                         may use negative values for        dy
  4424.                                                        and 
  4425.                                                     dx        in
  4426.                         order to increase the size of a rectangle
  4427.                         rather than descrease it's size.
  4428.  
  4429.             See also    MGL_offsetRect(), MGL_disjoingRect(),
  4430.                         MGL_ptInRect()
  4431.  
  4432.  
  4433.             MGL_line
  4434.  
  4435.             Function    Draws a line.
  4436.  
  4437.             Syntax      void MGL_line(point p1,point p2);
  4438.  
  4439.             Prototype   mgraph.h
  4440.             in
  4441.  
  4442.             Parameters  p1 - Starting point for the line
  4443.                         p2 - Ending point for the line
  4444.  
  4445.             Remarks     MGL_line() draws a line starting at the point
  4446.                         p1 and ending at the point p2 in the current
  4447.                         pen style, color and dimensions. The CP is
  4448.                         not updated, and the line is clipped to the
  4449.                         current clipping rectangle if clipping in on.
  4450.  
  4451.             See also    MGL_lineCoord(), MGL_lineFast(),
  4452.                         MGL_lineCoordFast(), MGL_lineTo(),
  4453.                         MGL_lineToCoord(), MGL_lineRel(),
  4454.                         MGL_lineRelCoord().
  4455.  
  4456.  
  4457.  
  4458.  
  4459.  
  4460.             66                      MegaGraph Graphics Library Reference
  4461.  
  4462.  
  4463.  
  4464.  
  4465.  
  4466.  
  4467.             MGL_lineCoord
  4468.  
  4469.             Function    Draws a line.
  4470.  
  4471.             Syntax      void MGL_lineCoord(int x1,int y1,int x2,int
  4472.                         y2);
  4473.  
  4474.             Prototype   mgraph.h
  4475.             in
  4476.  
  4477.             Parameters  x1,y1 - Starting point for the line
  4478.                         x2,y2 - Ending point for the line
  4479.  
  4480.             Remarks     MGL_lineCoord() draws a line starting at the
  4481.                         point         and ending at the point 
  4482.                               (x1,y1)                         (x2,y2)
  4483.                         in the current pen style, color and
  4484.                         dimensions. The CP is not updated, and the
  4485.                         line is clipped to the current clipping
  4486.                         rectangle if clipping in on.
  4487.  
  4488.             See also    MGL_lineCoord(), MGL_lineFast(),
  4489.                         MGL_lineCoordFast(), MGL_lineTo(),
  4490.                         MGL_lineToCoord(), MGL_lineRel(),
  4491.                         MGL_lineRelCoord().
  4492.  
  4493.  
  4494.             MGL_lineCoordFast
  4495.  
  4496.             Function    Draws a line as fast as possible.
  4497.  
  4498.             Syntax      void MGL_lineCoordFast(int x1,int y1,int
  4499.                         x2,int y2);
  4500.  
  4501.             Prototype   mgraph.h
  4502.             in
  4503.  
  4504.             Parameters  x1,y1 - Starting point for the line
  4505.                         x2,y2 - Ending point for the line
  4506.  
  4507.             Remarks     MGL_lineCoordFast() draws a line starting at
  4508.                         the point (x1,y1) and ending at the point
  4509.                         (x2,y2) in the current pen style, color and
  4510.                         dimensions. The CP is not updated, and the
  4511.                         line is clipped to the current clipping
  4512.                         rectangle if clipping in on.
  4513.  
  4514.                         Note: You must call the routine
  4515.                         MGL_beginDrawing() before calling the
  4516.                         MGL_lineCoordFast() routine to put the
  4517.                         hardware into the correct state fo for high
  4518.                         speed line drawing. The routines MGL_line()
  4519.                         and MGL_lineCoord() do this once for every
  4520.                         line to be drawn, so you can save time by
  4521.                         calling MGL_beginDrawing() once before
  4522.                         drawing a whole set of lines.
  4523.  
  4524.  
  4525.  
  4526.  
  4527.  
  4528.             Chapter 6 - Console Library                               67
  4529.  
  4530.  
  4531.  
  4532.  
  4533.  
  4534.  
  4535.             See also    MGL_lineCoord(), MGL_lineFast(),
  4536.                         MGL_lineCoordFast(), MGL_lineTo(),
  4537.                         MGL_lineToCoord(), MGL_lineRel(),
  4538.                         MGL_lineRelCoord(), MGL_beginDrawing(),
  4539.                         MGL_endDrawing().
  4540.  
  4541.  
  4542.             MGL_lineEngine
  4543.  
  4544.             Function    Generates the set of points on a line.
  4545.  
  4546.             Syntax      void MGL_lineEngine(int x1,int y1,int x2,int
  4547.                         y2,void (*plotPoint)(int x,int y));
  4548.  
  4549.             Prototype   mgraph.h
  4550.             in
  4551.  
  4552.             Parameters  x1,y1 - Starting point for the line
  4553.                         x2,y2 - Ending point for the line
  4554.                         plotPoint - User supplied pixel plotting
  4555.                         routine.
  4556.  
  4557.             Remarks     MGL_lineEngine() generates the set of points
  4558.                         on a line, and calls a user supplied
  4559.                         plotPoint routine for every point generated.
  4560.                         This is the same routine used for rendering
  4561.                         lines internally in the MGL.
  4562.  
  4563.                         The use supplied plotPoint routine will be
  4564.                         called once for every point on the line. The
  4565.                         set of points generated will always be in the
  4566.                         same order for any two endpoints, no matter
  4567.                         which order the endpoints are given.
  4568.  
  4569.             See also    MGL_ellipseEngine().
  4570.  
  4571.  
  4572.             MGL_lineFast
  4573.  
  4574.             Function    Draws a line as fast as possible.
  4575.  
  4576.             Syntax      void MGL_lineFast(point p1,point p2);
  4577.  
  4578.             Prototype   mgraph.h
  4579.             in
  4580.  
  4581.             Parameters  p1 - Starting point for the line
  4582.                         p2 - Ending point for the line
  4583.  
  4584.  
  4585.  
  4586.  
  4587.  
  4588.  
  4589.  
  4590.  
  4591.  
  4592.  
  4593.  
  4594.  
  4595.             68                      MegaGraph Graphics Library Reference
  4596.  
  4597.  
  4598.  
  4599.  
  4600.  
  4601.  
  4602.             Remarks     MGL_lineFast() draws a line starting at the
  4603.                         point    and ending at the point 
  4604.                               p1                            in the
  4605.                                                          p2
  4606.                         current pen style, color and dimensions. The
  4607.                         CP is not updated, and the line is clipped to
  4608.                         the current clipping rectangle if clipping in
  4609.                         on.
  4610.  
  4611.                         Note: You      call the routine
  4612.                                   must
  4613.                         MGL_beginDrawing()        calling the
  4614.                                            before
  4615.                         MGL_lineFast() routine to put the hardware
  4616.                         into the correct state fo for high speed line
  4617.                         drawing. The routines MGL_line() and
  4618.                         MGL_lineCoord() do this once for every line
  4619.                         to be drawn, so you can save time by calling
  4620.                         MGL_beginDrawing() once before drawing a
  4621.                         whole set of lines.
  4622.  
  4623.             See also    MGL_lineCoord(), MGL_lineFast(),
  4624.                         MGL_lineCoordFast(), MGL_lineTo(),
  4625.                         MGL_lineToCoord(), MGL_lineRel(),
  4626.                         MGL_lineRelCoord(), MGL_beginDrawing(),
  4627.                         MGL_endDrawing().
  4628.  
  4629.  
  4630.             MGL_lineRel
  4631.  
  4632.             Function    Draws a relative line from the CP.
  4633.  
  4634.             Syntax      void MGL_lineRel(point p)
  4635.  
  4636.             Prototype   mgraph.h
  4637.             in
  4638.  
  4639.             Parameters  p - Relative point to draw line to.
  4640.  
  4641.             Remarks     MGL_lineRel() draws a line from the current
  4642.                         position (CP) to the relative location that
  4643.                         is a distance of   away from the CP. Thus the
  4644.                                          p
  4645.                         location of the next point on the line is
  4646.                         (CP.x + p.x, CP.y + p.y). The CP is updated
  4647.                         to this value.
  4648.  
  4649.             See also    MGL_moveTo(), MGL_moveRel(), MGL_lineTo(),
  4650.                         MGL_lineRel().
  4651.  
  4652.  
  4653.             MGL_lineRelCoord
  4654.  
  4655.             Function    Draws a relative line.
  4656.  
  4657.             Syntax      void MGL_lineRelCoord(int dx,int dy);
  4658.  
  4659.             Prototype   mgraph.h
  4660.             in
  4661.  
  4662.             Parameters  dx,dy - Relative point to draw line to.
  4663.  
  4664.  
  4665.  
  4666.  
  4667.             Chapter 6 - Console Library                               69
  4668.  
  4669.  
  4670.  
  4671.  
  4672.  
  4673.  
  4674.             Remarks     MGL_lineRelCoord() draws a line from the
  4675.                         current position (CP) to the relative
  4676.                         location that is a distance of (dx,dy) away
  4677.                         from the CP. Thus the location of the next
  4678.                         point on the line is (CP.x + dx, CP.y + dy).
  4679.                         The CP is updated to this value.
  4680.  
  4681.             See also    MGL_moveTo(), MGL_moveToCoord(),
  4682.                         MGL_moveRel(), MGL_moveRelCoord(),
  4683.                         MGL_lineTo(), MGL_lineToCoord(),
  4684.                         MGL_lineRel(), MGL_lineRelCoord().
  4685.  
  4686.  
  4687.             MGL_lineTo
  4688.  
  4689.             Function    Draws a line from the CP to the specified
  4690.                         point.
  4691.  
  4692.             Syntax      void MGL_lineTo(point p);
  4693.  
  4694.             Prototype   mgraph.h
  4695.             in
  4696.  
  4697.             Parameters  p - Point to draw the line to.
  4698.  
  4699.             Remarks     MGL_lineTo() draws a line from the current
  4700.                         position (CP) to the new point p. The CP is
  4701.                         set to the point   on return from this
  4702.                                          p
  4703.                         routine.
  4704.  
  4705.             See also    MGL_moveTo(), MGL_moveToCoord(),
  4706.                         MGL_moveRel(), MGL_moveRelCoord(),
  4707.                         MGL_lineTo(), MGL_lineToCoord(),
  4708.                         MGL_lineRel(), MGL_lineRelCoord().
  4709.  
  4710.  
  4711.             MGL_lineToCoord
  4712.  
  4713.             Function    Draws a line from the CP to the specified
  4714.                         point.
  4715.  
  4716.             Syntax      void MGL_lineToCoord(int x,int y);
  4717.  
  4718.             Prototype   mgraph.h
  4719.             in
  4720.  
  4721.             Parameters  x,y - Point to draw the line to.
  4722.  
  4723.             Remarks     MGL_lineToCoord() draws a line from the
  4724.                         current position (CP) to the new point (x,y).
  4725.                         The CP is set to the point       on return
  4726.                                                    (x,y)
  4727.                         from this routine.
  4728.  
  4729.             See also    MGL_moveTo(), MGL_moveToCoord(),
  4730.                         MGL_moveRel(), MGL_moveRelCoord(),
  4731.                         MGL_lineTo(), MGL_lineToCoord(),
  4732.                         MGL_lineRel(), MGL_lineRelCoord().
  4733.  
  4734.  
  4735.  
  4736.             70                      MegaGraph Graphics Library Reference
  4737.  
  4738.  
  4739.  
  4740.  
  4741.  
  4742.  
  4743.             MGL_loadFont
  4744.  
  4745.             Function    Loads an MGL font file for use.
  4746.  
  4747.             Syntax      font *MGL_loadFont(const char *fontname);
  4748.  
  4749.             Prototype   mgraph.h
  4750.             in
  4751.  
  4752.             Parameters  fontname - Name of the font file to load
  4753.  
  4754.             Remarks     MGL_loadFont() attempts to locate and read in
  4755.                         the font specified by fontname. The parameter
  4756.                         fontname is the name of the actual MGL font
  4757.                         file on disk, and may include a relative
  4758.                         pathname component. MGL_loadFont() first
  4759.                         looks for the font file relative to the
  4760.                         directory where it found the MGL driver files
  4761.                         at initialisation time, and will then look
  4762.                         for the font file relative to the current
  4763.                         directory if the fontfile was not found.
  4764.  
  4765.                         If the font file was not found, or was not
  4766.                         successfully loaded, MGL_loadFont returns
  4767.                         NULL, and sets the MGL_result() error code.
  4768.  
  4769.             Return      Pointer to the loaded font file (NULL if an
  4770.             value       error occurred).
  4771.  
  4772.             See also    MGL_unloadFont(), MGL_useFont(),
  4773.                         MGL_availableFont().
  4774.  
  4775.  
  4776.             MGL_localToGlobal
  4777.  
  4778.             Function    Converts a point from local coordinates to
  4779.                         global coordinates
  4780.  
  4781.             Syntax      void MGL_localToGlobal(point *p);
  4782.  
  4783.             Prototype   mgraph.h
  4784.             in
  4785.  
  4786.             Parameters  p - Pointer to point to be converted
  4787.  
  4788.             Remarks     MGL_localToGlobal() converts a coordinate
  4789.                         from local coordinates to global coordinates.
  4790.                         Global coordinates are defined relative to
  4791.                         the entire output devices display, while
  4792.                         local coordinates are relative to the
  4793.                         currently active viewport.
  4794.  
  4795.             See also    MGL_globalToLocal()
  4796.  
  4797.  
  4798.  
  4799.  
  4800.  
  4801.  
  4802.  
  4803.             Chapter 6 - Console Library                               71
  4804.  
  4805.  
  4806.  
  4807.  
  4808.  
  4809.  
  4810.             MGL_marker
  4811.  
  4812.             Function    Draws a marker at the specified coordinate.
  4813.  
  4814.             Syntax      void MGL_marker(point p);
  4815.  
  4816.             Prototype   mgraph.h
  4817.             in
  4818.  
  4819.             Parameters  p - Coordinate to draw the marker at
  4820.  
  4821.             Remarks     MGL_marker() draws a marker in the current
  4822.                         marker color, style and size at the specified
  4823.                         location. Markers can be used to label the
  4824.                         vertices in graphs. Refer to the
  4825.                         MGL_setMarkerStyle() routine for a list of
  4826.                         the typs of markers supported.
  4827.  
  4828.             See also    MGL_setMarkerSize(), MGL_getMarkerSize(),
  4829.                         MGL_setMarkerStyle(), MGL_getMarkerStyle(),
  4830.                         MGL_polyMarker()
  4831.  
  4832.  
  4833.             MGL_maxCharWidth
  4834.  
  4835.             Function    Returns the maximum character width for
  4836.                         current font.
  4837.  
  4838.             Syntax      int MGL_maxCharWidth(void);
  4839.  
  4840.             Prototype   mgraph.h
  4841.             in
  4842.  
  4843.             Remarks     MGL_maxCharWidth() returns the maximum
  4844.                         character width for the currently active
  4845.                         font. You can use this routine to quickly
  4846.                         determine if a character will possibly
  4847.                         overlap something else on the display screen.
  4848.  
  4849.             Return      Maximum character width for current font.
  4850.             value
  4851.  
  4852.             See also    MGL_getCharMetrics(), MGL_getFontMetrics(),
  4853.                         MGL_textHeight(), MGL_textWidth(),
  4854.                         MGL_charWidth()
  4855.  
  4856.  
  4857.             MGL_maxColor
  4858.  
  4859.             Function    Returns the maximum available color value.
  4860.  
  4861.             Syntax      color_t MGL_maxColor(void);
  4862.  
  4863.             Prototype   mgraph.h
  4864.             in
  4865.  
  4866.  
  4867.  
  4868.  
  4869.  
  4870.             72                      MegaGraph Graphics Library Reference
  4871.  
  4872.  
  4873.  
  4874.  
  4875.  
  4876.  
  4877.             Remarks     MGL_maxColor() retutns the values of the
  4878.                         largest available color values for the
  4879.                         current video modes. This value will always
  4880.                         be one less than the number of available
  4881.                         colors in that particular video mode.
  4882.  
  4883.             Return      Maximum color value for current video mode.
  4884.             value
  4885.  
  4886.  
  4887.             MGL_maxPage
  4888.  
  4889.             Function    Returns the maximum available hardware video
  4890.                         page.
  4891.  
  4892.             Syntax      int MGL_maxPage(void);
  4893.  
  4894.             Prototype   mgraph.h
  4895.             in
  4896.  
  4897.             Remarks     MGL_maxPage() returns the index of the
  4898.                         highest hardware video page that is
  4899.                         available. This value will always be one less
  4900.                         than the number of hardware video pages
  4901.                         available. Some video modes only have one
  4902.                         hardware video page available, so this value
  4903.                         will be 0.
  4904.  
  4905.             Return      Index of maximum available hardware video
  4906.             value       page.
  4907.  
  4908.  
  4909.             MGL_maxx
  4910.  
  4911.             Function    Returns the current maximum X coordinate
  4912.  
  4913.             Syntax      int MGL_maxx(void);
  4914.  
  4915.             Prototype   mgraph.h
  4916.             in
  4917.  
  4918.             Remarks     MGL_maxx() returns the maximum X coordinate
  4919.                         available in the currently active viewport.
  4920.                         This value will change if you change the
  4921.                         dimensions of the current viewport.
  4922.  
  4923.                         Use the MGL_sizex() routine to determine the
  4924.                         dimensions of the physical display area
  4925.                         available to the program.
  4926.  
  4927.             Return      Maximum X coordinate in current viewport.
  4928.             value
  4929.  
  4930.             See also    MGL_maxy(), MGL_sizex(), MGL_sizey()
  4931.  
  4932.  
  4933.  
  4934.  
  4935.  
  4936.  
  4937.             Chapter 6 - Console Library                               73
  4938.  
  4939.  
  4940.  
  4941.  
  4942.  
  4943.  
  4944.             MGL_maxy
  4945.  
  4946.             Function    Returns the current maximum Y coordinate
  4947.  
  4948.             Syntax      int MGL_maxy(void);
  4949.  
  4950.             Prototype   mgraph.h
  4951.             in
  4952.  
  4953.             Remarks     MGL_maxy() returns the maximum Y coordinate
  4954.                         available in the currently active viewport.
  4955.                         This value will change if you change the
  4956.                         dimensions of the current viewport.
  4957.  
  4958.                         Use the MGL_sizey() routine to determine the
  4959.                         dimensions of the physical display area
  4960.                         available to the program.
  4961.  
  4962.             Return      Maximum Y coordinate in current viewport.
  4963.             value
  4964.  
  4965.             See also    MGL_maxx(), MGL_sizex(), MGL_sizey()
  4966.  
  4967.  
  4968.             MGL_modeName
  4969.  
  4970.             Function    Returns textual representation of the
  4971.                         specified video mode.
  4972.  
  4973.             Syntax      char *MGL_modeName(int mode);
  4974.  
  4975.             Prototype   mgraph.h
  4976.             in
  4977.  
  4978.             Parameters  mode - Video mode number to get name for.
  4979.  
  4980.             Remarks     MGL_modeName() returns a string representing
  4981.                         the specified video mode number.
  4982.  
  4983.             Return      Pointer to a string representing the name of
  4984.             value       the mode.
  4985.  
  4986.             See also    MGL_driverName().
  4987.  
  4988.  
  4989.             MGL_moveRel
  4990.  
  4991.             Function    Moves the CP to a new relative location.
  4992.  
  4993.             Syntax      void MGL_moveRel(point p)
  4994.  
  4995.             Prototype   mgraph.h
  4996.             in
  4997.  
  4998.             Parameters  p - Relative point to move the CP to.
  4999.  
  5000.  
  5001.  
  5002.  
  5003.  
  5004.             74                      MegaGraph Graphics Library Reference
  5005.  
  5006.  
  5007.  
  5008.  
  5009.  
  5010.  
  5011.             Remarks     MGL_moveRel() moves the current position (CP)
  5012.                         to the relative location that is a distance
  5013.                              away from the CP. Thus the location of
  5014.                            p
  5015.                         of 
  5016.                         the CP moves to is (CP.x + p.x, CP.y + p.y).
  5017.  
  5018.             See also    MGL_moveTo(), MGL_moveToCoord(),
  5019.                         MGL_moveRelCoord(), MGL_lineTo(),
  5020.                         MGL_lineToCoord(), MGL_lineRel(),
  5021.                         MGL_lineRelCoord().
  5022.  
  5023.  
  5024.             MGL_moveRelCoord
  5025.  
  5026.             Function    Moves the CP to a new relative location
  5027.  
  5028.             Syntax      void MGL_moveRelCoord(int dx,int dy);
  5029.  
  5030.             Prototype   mgraph.h
  5031.             in
  5032.  
  5033.             Parameters  dx,dy - Relative point to move the CP to.
  5034.  
  5035.             Remarks     MGL_moveRelCoord() moves the current position
  5036.                         (CP) to the relative location that is a
  5037.                         distance of (dx,dy) away from the CP. Thus
  5038.                         the location the CP is moved to is (CP.x +
  5039.                         dx, CP.y + dy).
  5040.  
  5041.             See also    MGL_moveTo(), MGL_moveToCoord(),
  5042.                         MGL_moveRel(), MGL_moveRelCoord(),
  5043.                         MGL_lineTo(), MGL_lineToCoord(),
  5044.                         MGL_lineRel(), MGL_lineRelCoord().
  5045.  
  5046.  
  5047.             MGL_moveTo
  5048.  
  5049.             Function    Moves the CP to a new location.
  5050.  
  5051.             Syntax      void MGL_moveTo(point p);
  5052.  
  5053.             Prototype   mgraph.h
  5054.             in
  5055.  
  5056.             Parameters  p - Point to move the CP to.
  5057.  
  5058.             Remarks     MGL_moveTo() moves the current position (CP)
  5059.                         to the new point p.
  5060.  
  5061.             See also    MGL_moveTo(), MGL_moveToCoord(),
  5062.                         MGL_moveRel(), MGL_moveRelCoord(),
  5063.                         MGL_lineTo(), MGL_lineToCoord(),
  5064.                         MGL_lineRel(), MGL_lineRelCoord().
  5065.  
  5066.  
  5067.  
  5068.  
  5069.  
  5070.  
  5071.  
  5072.  
  5073.             Chapter 6 - Console Library                               75
  5074.  
  5075.  
  5076.  
  5077.  
  5078.  
  5079.  
  5080.             MGL_moveToCoord
  5081.  
  5082.             Function    Moves the CP to a new location.
  5083.  
  5084.             Syntax      void MGL_moveToCoord(int x,int y);
  5085.  
  5086.             Prototype   mgraph.h
  5087.             in
  5088.  
  5089.             Parameters  x,y - Point to move the CP to.
  5090.  
  5091.             Remarks     MGL_moveToCoord() moves the current position
  5092.                         (CP) to the new point (x,y).
  5093.  
  5094.             See also    MGL_moveTo(), MGL_moveToCoord(),
  5095.                         MGL_moveRel(), MGL_moveRelCoord(),
  5096.                         MGL_lineTo(), MGL_lineToCoord(),
  5097.                         MGL_lineRel(), MGL_lineRelCoord().
  5098.  
  5099.  
  5100.             MGL_offsetRect
  5101.  
  5102.             Function    Offsets a rectangle by a specified amount
  5103.  
  5104.             Syntax      void MGL_offsetRect(rect r,int dx,int dy)
  5105.  
  5106.             Prototype   mgraph.h
  5107.             in
  5108.  
  5109.             Parameters  r - Rectangle to offset
  5110.                         dx - Value to offset the X coordinates by
  5111.                         dy - Value to offset the Y coordinates by
  5112.  
  5113.             Remarks     MGL_offsetRect() moves the start of a
  5114.                         rectangle to a new location, by adding the
  5115.                         specified offset values to the X and Y
  5116.                         coordinate values. The size of the rectangle
  5117.                         is not changes, just it's location.
  5118.  
  5119.             See also    MGL_insetRect(), MGL_disjoingRect(),
  5120.                         MGL_ptInRect()
  5121.  
  5122.  
  5123.             MGL_packColor
  5124.  
  5125.             Function    Packs an RGB color value.
  5126.  
  5127.             Syntax      color_t MGL_packColor(uchar R,uchar G,uchar
  5128.                         B);
  5129.  
  5130.             Prototype   mgraph.h
  5131.             in
  5132.  
  5133.             Parameters  R - Red color component (0-255)
  5134.                         G - Green color component (0-255)
  5135.                         B - Blue color component (0-255)
  5136.  
  5137.  
  5138.  
  5139.  
  5140.             76                      MegaGraph Graphics Library Reference
  5141.  
  5142.  
  5143.  
  5144.  
  5145.  
  5146.  
  5147.             Remarks     MGL_packColor() takes 8 bit color component
  5148.                         values and packs them into a packed color
  5149.                         value that is appropriate for the current
  5150.                         video mode. This function only works properly
  5151.                         in the HiColor and TrueColor modes, as you
  5152.                         cannot specifiy RGB values in the color
  5153.                         mapped modes.
  5154.  
  5155.             Return      MGL packed color value appropriate for the
  5156.             value       current video mode.
  5157.  
  5158.             See also    MGL_unpackColor().
  5159.  
  5160.  
  5161.             MGL_pixel
  5162.  
  5163.             Function    Draws a pixel at the specified location
  5164.  
  5165.             Syntax      void MGL_pixel(point p)
  5166.  
  5167.             Prototype   mgraph.h
  5168.             in
  5169.  
  5170.             Parameters  p - Point to plot the point at it.
  5171.  
  5172.             Remarks     MGL_pixel() plots a single pixel at the
  5173.                         specified location in the current foregrond
  5174.                         color.
  5175.  
  5176.                         Note: You      call the routine
  5177.                                   must
  5178.                         MGL_beginPixel() routine before calling the
  5179.                         MGL_pixel(), and you must call the
  5180.                         MGL_endPixel() routine after you have
  5181.                         finished plotting pixels.
  5182.  
  5183.             See also    MGL_pixelCoord(), MGL_beginPixel(),
  5184.                         MGL_endPixel().
  5185.  
  5186.  
  5187.             MGL_pixelCoord
  5188.  
  5189.             Function    Draws a pixel at the specified location
  5190.  
  5191.             Syntax      void MGL_pixelCoord(int x,int y);
  5192.  
  5193.             Prototype   mgraph.h
  5194.             in
  5195.  
  5196.             Parameters  x,y - Point to plot the point at it.
  5197.  
  5198.  
  5199.  
  5200.  
  5201.  
  5202.  
  5203.  
  5204.  
  5205.  
  5206.  
  5207.  
  5208.             Chapter 6 - Console Library                               77
  5209.  
  5210.  
  5211.  
  5212.  
  5213.  
  5214.  
  5215.             Remarks     MGL_pixelCoord() plots a single pixel at the
  5216.                         specified location in the current foregrond
  5217.                         color.
  5218.  
  5219.                         Note: You      call the routine
  5220.                                   must
  5221.                         MGL_beginPixel() routine before calling the
  5222.                         MGL_pixel(), and you      call the
  5223.                                              must
  5224.                         MGL_endPixel() routine after you have
  5225.                         finished plotting pixels.
  5226.  
  5227.             See also    MGL_pixelCoord(), MGL_beginPixel(),
  5228.                         MGL_endPixel().
  5229.  
  5230.  
  5231.             MGL_polyLine
  5232.  
  5233.             Function    Draws a set of connected lines.
  5234.  
  5235.             Syntax      void MGL_polyLine(int count,point *vArray);
  5236.  
  5237.             Prototype   mgraph.h
  5238.             in
  5239.  
  5240.             Parameters  count - Number of vertices in polyline
  5241.                         vArray - Array of vertices in the polyline
  5242.  
  5243.             Remarks     MGL_polyLine() draws a set of connected line
  5244.                         (a polyline). The coordinates of the polyline
  5245.                         are specified by       , and the lines are
  5246.                                          vArray
  5247.                         drawn in the current drawing attributes.
  5248.  
  5249.                         Note: The polyline is not closed by default,
  5250.                         so if you wish to draw the outline of a
  5251.                         polygon, you will need to add the starting
  5252.                         point to the end of the vertex array.
  5253.  
  5254.             See also    MGL_polyMarker(), MGL_polyPoint().
  5255.  
  5256.  
  5257.             MGL_polyMarker
  5258.  
  5259.             Function    Draws a set of markers.
  5260.  
  5261.             Syntax      void MGL_polyMarker(int count,point *vArray);
  5262.  
  5263.             Prototype   mgraph.h
  5264.             in
  5265.  
  5266.             Parameters  count - Number of markers to draw
  5267.                         vArray - Array of coordinates to draw the
  5268.                         markers at
  5269.  
  5270.             Remarks     MGL_polyMarker() draws a set of markers in
  5271.                         the current marker color, style and size at
  5272.                         the locations passed in the        parameter.
  5273.                                                     vArray
  5274.  
  5275.             See also    MGL_polyLine(), MGL_polyPoint()
  5276.  
  5277.  
  5278.  
  5279.             78                      MegaGraph Graphics Library Reference
  5280.  
  5281.  
  5282.  
  5283.  
  5284.  
  5285.  
  5286.             MGL_polyPoint
  5287.  
  5288.             Function    Draws a set of pixels.
  5289.  
  5290.             Syntax      void MGL_polyPoint(int count,point *vArray);
  5291.  
  5292.             Prototype   mgraph.h
  5293.             in
  5294.  
  5295.             Parameters  count - Number of pixels to draw
  5296.                         vArray - Array of coordinates to draw the
  5297.                         pixels at
  5298.  
  5299.             Remarks     MGL_polyPoint() draws a set of pixels in the
  5300.                         current color at the locations passed in the
  5301.                         vArray parameter.
  5302.  
  5303.             See also    MGL_polyLine(), MGL_polyPoint()
  5304.  
  5305.  
  5306.             MGL_popViewport
  5307.  
  5308.             Function    Pops the current viewport off the stack.
  5309.  
  5310.             Syntax      void MGL_popViewport(void);
  5311.  
  5312.             Prototype   mgraph.h
  5313.             in
  5314.  
  5315.             Remarks     MGL_popViewport() pops the viewport off the
  5316.                         top of the viewport stack and makes it the
  5317.                         new active viewport.
  5318.  
  5319.                         The MGL maintains a viewport stack that you
  5320.                         may use to temporarily push viewport settings
  5321.                         onto for later retrival.
  5322.  
  5323.             See also    MGL_pushViewport(), MGL_setViewport(),
  5324.                         MGL_getViewport()
  5325.  
  5326.  
  5327.             MGL_ptInRect
  5328.  
  5329.             Function    Determines if a point is in a rectangle.
  5330.  
  5331.             Syntax      bool MGL_ptInRect(point p,rect r);
  5332.  
  5333.             Prototype   mgraph.h
  5334.             in
  5335.  
  5336.             Parameters  p - Point to test
  5337.                         r - Rectangle to test point against
  5338.  
  5339.             Remarks     MGL_ptInRect() determines if a specified
  5340.                         point is contained within a particular
  5341.                         rectangle.
  5342.  
  5343.  
  5344.  
  5345.  
  5346.             Chapter 6 - Console Library                               79
  5347.  
  5348.  
  5349.  
  5350.  
  5351.  
  5352.  
  5353.             Return      True if the point is contained in the
  5354.             value       rectangle, false if not.
  5355.  
  5356.             See also    MGL_ptInRectCoord().
  5357.  
  5358.  
  5359.             MGL_ptInRectCoord
  5360.  
  5361.             Function    Determines if a point is in a rectangle.
  5362.  
  5363.             Syntax      bool MGL_ptInRectCoord(int x,int y,rect r)
  5364.  
  5365.             Prototype   mgraph.h
  5366.             in
  5367.  
  5368.             Parameters  x,y - Point to test
  5369.                         r - Rectangle to test point against
  5370.  
  5371.             Remarks     MGL_ptInRectCoord() determines if a specified
  5372.                         point is contained within a particular
  5373.                         rectangle.
  5374.  
  5375.             Return      True if the point is contained in the
  5376.             value       rectangle, false if not.
  5377.  
  5378.             See also    MGL_ptInRect()
  5379.  
  5380.  
  5381.             MGL_pushViewport
  5382.  
  5383.             Function    Pushes the current viewport onto the stack.
  5384.  
  5385.             Syntax      void MGL_pushViewport(void);
  5386.  
  5387.             Prototype   mgraph.h
  5388.             in
  5389.  
  5390.             Remarks     MGL_pushViewport() pushs the current viewport
  5391.                         values onto the viewport stack, to be
  5392.                         retrieved at a later date.
  5393.  
  5394.             See also    MGL_popViewport(), MGL_setViewport(),
  5395.                         MGL_getViewport()
  5396.  
  5397.  
  5398.             MGL_putDivot
  5399.  
  5400.             Function    Replaces a divot of video memory.
  5401.  
  5402.             Syntax      void MGL_putDivot(void *divot);
  5403.  
  5404.             Prototype   mgraph.h
  5405.             in
  5406.  
  5407.             Parameters  divot - Pointer to the divot to replace
  5408.  
  5409.  
  5410.  
  5411.  
  5412.  
  5413.             80                      MegaGraph Graphics Library Reference
  5414.  
  5415.  
  5416.  
  5417.  
  5418.  
  5419.  
  5420.             Remarks     MGL_putDivot() replaces a region of video
  5421.                         memory that was saved previously with an
  5422.                         MGL_getDivot() routine. The divot is replaced
  5423.                         at the same location that is was taken from
  5424.                         on the current display page.
  5425.  
  5426.             See also    MGL_getDivot(), MGL_divotSize(),
  5427.                         MGL_getImage(), MGL_putImage()
  5428.  
  5429.  
  5430.             MGL_putIcon
  5431.  
  5432.             Function    Draws an icon at the specified location.
  5433.  
  5434.             Syntax      void MGL_putIcon(int x,int y,icon_header
  5435.                         *icon);
  5436.  
  5437.             Prototype   mgraph.h
  5438.             in
  5439.  
  5440.             Parameters  x,y - Coordinates to draw the icon at
  5441.                         icon - Pointer to the icon data to draw
  5442.  
  5443.             Remarks     MGL_putIcon() draws an icon at the specified
  5444.                         location. The icon      be in the correct
  5445.                                            must
  5446.                         format for the current video mode. The icon
  5447.                         is drawn by punching a black hole in the
  5448.                         background with the icon mask, and then
  5449.                         OR'ing in the the image data for the icon.
  5450.  
  5451.  
  5452.             MGL_putImage
  5453.  
  5454.             Function    Draws a video memory image on the display
  5455.  
  5456.             Syntax      void MGL_putImage(rect r,void *image,int op)
  5457.  
  5458.             Prototype   mgraph.h
  5459.             in
  5460.  
  5461.             Parameters  r - Rectangle to draw the image at
  5462.                         image - Pointer to the image to draw
  5463.                         op - Write mode operation to use.
  5464.  
  5465.  
  5466.  
  5467.  
  5468.  
  5469.  
  5470.  
  5471.  
  5472.  
  5473.  
  5474.  
  5475.  
  5476.  
  5477.  
  5478.  
  5479.  
  5480.  
  5481.             Chapter 6 - Console Library                               81
  5482.  
  5483.  
  5484.  
  5485.  
  5486.  
  5487.  
  5488.             Remarks     MGL_putImage() blasts the specified video
  5489.                         memory image to the display memory at the
  5490.                         specified location. If the image is larger
  5491.                         than the destination rectangle, it will be
  5492.                         clipped to the current destination rectangle
  5493.                         extents. You may specify any of the following
  5494.                         write mode operations to be used when moving
  5495.                         the image to video memory:
  5496.  
  5497.                         REPLACE_MODE - Replace the original pixels
  5498.                         AND_MODE     - Logical AND with original
  5499.                         pixels
  5500.                         OR_MODE      - Logical OR with original
  5501.                         pixels
  5502.                         XOR_MODE     - Logical XOR with original
  5503.                         pixels
  5504.  
  5505.             See also    MGL_putImageCoord(), MGL_getImage(),
  5506.                         MGL_getImageCoord(), MGL_imageSize().
  5507.  
  5508.  
  5509.             MGL_putImageCoord
  5510.  
  5511.             Function    Draws a video memory image on the display
  5512.  
  5513.             Syntax      void MGL_putImageCoord(int left,int top,int
  5514.                         right,int bottom,void *image,int op);
  5515.  
  5516.             Prototype   mgraph.h
  5517.             in
  5518.  
  5519.             Parameters  left - Left coordinate to draw image at
  5520.                         top - Top coordinate to draw image at
  5521.                         right - Right coordinate to draw image at
  5522.                         bottom - Bottom coordinate to draw image at
  5523.                         image - Pointer to the image to draw
  5524.                         op - Write mode operation to use.
  5525.  
  5526.             Remarks     MGL_putImageCoord() blasts the specified
  5527.                         video memory image to the display memory at
  5528.                         the specified location. If the image is
  5529.                         larger than the destination rectangle, it
  5530.                         will be clipped to the current destination
  5531.                         rectangle extents. You may specify any of the
  5532.                         following write mode operations to be used
  5533.                         when moving the image to video memory:
  5534.  
  5535.                         REPLACE_MODE
  5536.                         AND_MODE
  5537.                         OR_MODE
  5538.                         XOR_MODE
  5539.  
  5540.             See also    MGL_putImage(), MGL_getImage(),
  5541.                         MGL_getImageCoord(), MGL_imageSize().
  5542.  
  5543.  
  5544.  
  5545.  
  5546.  
  5547.  
  5548.             82                      MegaGraph Graphics Library Reference
  5549.  
  5550.  
  5551.  
  5552.  
  5553.  
  5554.  
  5555.             MGL_putMonoImage
  5556.  
  5557.             Function    Plots a monochromatic image.
  5558.  
  5559.             Syntax      void MGL_putMonoImage(int x,int y,int
  5560.                         byteWidth,int height,void *image);
  5561.  
  5562.             Prototype   mgraph.h
  5563.             in
  5564.  
  5565.             Parameters  x,y - Coordinate to plot the image at
  5566.                         byteWidth - Width of the image in bytes
  5567.                         height - Height of the image in scanlines
  5568.                         image - Pointer to the buffer holding the
  5569.                         image
  5570.  
  5571.             Remarks     MGL_putMonoImage() displays a single color
  5572.                         image in the current foreground color. Where
  5573.                         a bit is a 1 in the image definition, a pixel
  5574.                         is plotted in the foreground color, where a
  5575.                         bit is a 0 the original pixels are left
  5576.                         alone.
  5577.  
  5578.             See also    MGL_getImage(), MGL_putImage().
  5579.  
  5580.  
  5581.             MGL_realColor
  5582.  
  5583.             Function    Returns the real color value for a color
  5584.                         mapped index.
  5585.  
  5586.             Syntax      color_t MGL_realColor(int color);
  5587.  
  5588.             Prototype   mgraph.h
  5589.             in
  5590.  
  5591.             Parameters  color -
  5592.  
  5593.             Remarks     MGL_realColor() returns a color value
  5594.                         appropriate for the current video mode, given
  5595.                         a color mapped index. This routine works in
  5596.                         all video modes, including the HiColor and
  5597.                         TrueColor video modes. In the color mapped
  5598.                         modes, the value is simply returned
  5599.                         unchanged. However in the HiColor and
  5600.                         TrueColor modes, the appropriate color is
  5601.                         looked up in the currently active palette.
  5602.                         Thus you can still write code for the HiColor
  5603.                         and TrueColor modes that works with color
  5604.                         mapped indexes (although you cannot do things
  5605.                         like hardware palette fades and rotates as
  5606.                         the palette is implemented in software).
  5607.  
  5608.             Return      Real color value for the color mapped index.
  5609.             value
  5610.  
  5611.             See also    MGL_setPalette(), MGL_getPalette().
  5612.  
  5613.  
  5614.  
  5615.             Chapter 6 - Console Library                               83
  5616.  
  5617.  
  5618.  
  5619.  
  5620.  
  5621.  
  5622.             MGL_rect
  5623.  
  5624.             Function    Draws a rectangle.
  5625.  
  5626.             Syntax      void MGL_rect(rect r);
  5627.  
  5628.             Prototype   mgraph.h
  5629.             in
  5630.  
  5631.             Parameters  r - Rectangle to draw
  5632.  
  5633.             Remarks     MGL_rect() draws a rectangle in the current
  5634.                         drawing attributes at the specified location.
  5635.                         The rectangle is drawn within the
  5636.                         mathematical boundary of the rectangle, so
  5637.                         effectively the right and bottom edges of the
  5638.                         rectangle are not drawn (solving problems
  5639.                         with shared edges). Degenerate rectangles are
  5640.                         not drawn.
  5641.  
  5642.             See also    MGL_rectCoord(), MGL_rectPt().
  5643.  
  5644.  
  5645.             MGL_rectCoord
  5646.  
  5647.             Function    Draws a rectangle.
  5648.  
  5649.             Syntax      void MGL_rectCoord(int left,int top,int
  5650.                         right,int bottom);
  5651.  
  5652.             Prototype   mgraph.h
  5653.             in
  5654.  
  5655.             Parameters  left - Left coordinate of the rectangle
  5656.                         top - Top coordinate of the rectangle
  5657.                         right - Right coordinate of the rectangle
  5658.                         bottom - Bottom coordinate of the rectangle
  5659.  
  5660.             Remarks     MGL_rectCoord() draws a rectangle in the
  5661.                         current drawing attributes at the specified
  5662.                         location. The rectangle is drawn within the
  5663.                         mathematical boundary of the rectangle, so
  5664.                         effectively the right and bottom edges of the
  5665.                         rectangle are not drawn (solving problems
  5666.                         with shared edges). Degenerate rectangles are
  5667.                         not drawn.
  5668.  
  5669.             See also    MGL_rect(), MGL_rectPt().
  5670.  
  5671.  
  5672.  
  5673.  
  5674.  
  5675.  
  5676.  
  5677.  
  5678.  
  5679.  
  5680.  
  5681.  
  5682.             84                      MegaGraph Graphics Library Reference
  5683.  
  5684.  
  5685.  
  5686.  
  5687.  
  5688.  
  5689.             MGL_rectPt
  5690.  
  5691.             Function    Draws a rectangle.
  5692.  
  5693.             Syntax      void MGL_rectPt(point lt,point rb);
  5694.  
  5695.             Prototype   mgraph.h
  5696.             in
  5697.  
  5698.             Parameters  lt - Left top coordinate of the rectangle
  5699.                         rb - Right bottom coordinate of the rectangle
  5700.  
  5701.             Remarks     MGL_rectPt() draws a rectangle in the current
  5702.                         drawing attributes at the specified location.
  5703.                         The rectangle is drawn within the
  5704.                         mathematical boundary of the rectangle, so
  5705.                         effectively the right and bottom edges of the
  5706.                         rectangle are not drawn (solving problems
  5707.                         with shared edges). Degenerate rectangles are
  5708.                         not drawn.
  5709.  
  5710.             See also    MGL_rect(), MGL_rectCoord().
  5711.  
  5712.  
  5713.             MGL_registerDriver
  5714.  
  5715.             Function    Registers a user loaded or linked device
  5716.                         driver
  5717.  
  5718.             Syntax      int MGL_registerDriver(const char *name,void
  5719.                         *driver);
  5720.  
  5721.             Prototype   mgraph.h
  5722.             in
  5723.  
  5724.             Parameters  name - Name of driver to register
  5725.                         driver - Pointer to the start of the driver
  5726.                         in memory
  5727.  
  5728.             Remarks     MGL_registerDriver() registers a linked in or
  5729.                         user loaded graphics driver with the graphics
  5730.                         system. The driver must be one of the
  5731.                         standard graphics device drivers supported by
  5732.                         the library. The loaded driver is checked to
  5733.                         ensure that it actually is a valid MGL device
  5734.                         driver.
  5735.  
  5736.                         This routine is usually used to inform the
  5737.                         MGL that the user has linked the device
  5738.                         driver code directly with the application (or
  5739.                         has loaded it onto the heap) so should not be
  5740.                         dynamically loaded from disk at runtime.
  5741.  
  5742.             Return      grOK on success, grBadDriver if driver passed
  5743.             value       was invalid
  5744.  
  5745.             See also    MGL_init()
  5746.  
  5747.  
  5748.  
  5749.             Chapter 6 - Console Library                               85
  5750.  
  5751.  
  5752.  
  5753.  
  5754.  
  5755.  
  5756.             MGL_restoreAttributes
  5757.  
  5758.             Function    Restores a previously saved attribute list
  5759.  
  5760.             Syntax      void MGL_restoreAttributes(attributes *attr);
  5761.  
  5762.             Prototype   mgraph.h
  5763.             in
  5764.  
  5765.             Parameters  attr - Pointer to the attribute list to
  5766.                         restore
  5767.  
  5768.             Remarks     MGL_restoreAttributes() restores a set of
  5769.                         attributes that were saved with the
  5770.                         MGL_getAttributes() routine. The attributes
  5771.                         list represents the current state of the MGL.
  5772.                         The value of the color palette is not changed
  5773.                         by this routine.
  5774.  
  5775.             See also    MGL_getAttributes
  5776.  
  5777.  
  5778.             MGL_restoreCRTMode
  5779.  
  5780.             Function    Resets the system back into text mode
  5781.  
  5782.             Syntax      void MGL_restoreCRTMode(void);
  5783.  
  5784.             Prototype   mgraph.h
  5785.             in
  5786.  
  5787.             Remarks     MGL_restoreCRTMode() resets the system back
  5788.                         into the original text mode that was present
  5789.                         before the MGL was started. If the system was
  5790.                         in the EGA/VGA 43/50 line modes, this mode
  5791.                         will be reset to its original state. The MGL
  5792.                         can be re-started with the MGL_setGraphMode()
  5793.                         routine.
  5794.  
  5795.             See also    MGL_init(), MGL_setGraphMode()
  5796.  
  5797.  
  5798.             MGL_result
  5799.  
  5800.             Function    Returns result code of the last graphics
  5801.                         operation
  5802.  
  5803.             Syntax      int MGL_result(void);
  5804.  
  5805.             Prototype   mgraph.h
  5806.             in
  5807.  
  5808.  
  5809.  
  5810.  
  5811.  
  5812.  
  5813.  
  5814.  
  5815.  
  5816.             86                      MegaGraph Graphics Library Reference
  5817.  
  5818.  
  5819.  
  5820.  
  5821.  
  5822.  
  5823.             Remarks     MGL_result() returns the result code of the
  5824.                         last graphics operation. The internal result
  5825.                         code is reset back to grOK on return from
  5826.                         this routine, so you should only call the
  5827.                         routine once after the graphics operation.
  5828.                         The following result codes are returned by
  5829.                         MGL_result:
  5830.  
  5831.                         grOK             No error
  5832.                         grNoInit         Graphics driver has not been
  5833.                         installed
  5834.                         grNotDetected    Graphics hardware was not
  5835.                         detected
  5836.                         grDriverNotFound Graphics driver file was not
  5837.                         found
  5838.                         grBadDriver      File loaded was not a
  5839.                         graphics driver
  5840.                         grLoadMem        Not enough memory to load
  5841.                         graphics driver
  5842.                         grInvalidMode    Invalid graphics mode for
  5843.                         selected driver
  5844.                         grInvalidDriver  Driver number is invalid
  5845.                         grError          General graphics error
  5846.                         grInvalidName    Invalid driver name
  5847.                         grNoMem          Not enough memory to perform
  5848.                         operation
  5849.                         grNoModeSupport  Select video mode not
  5850.                         supported by hardware
  5851.                         grInvalidFont    Invalid font data
  5852.                         grBadFontFile    File loaded was not a font
  5853.                         file
  5854.                         grFontNotFound   Font file was not found
  5855.  
  5856.             Return      Result code of the last graphics operation
  5857.             value
  5858.  
  5859.             See also    MGL_setResult()
  5860.  
  5861.  
  5862.             MGL_rotatePalette
  5863.  
  5864.             Function    Rotates the values in a palette structure
  5865.  
  5866.             Syntax      void MGL_rotatePalette(palette *pal,int
  5867.                         numColors,int direction);
  5868.  
  5869.             Prototype   mgraph.h
  5870.             in
  5871.  
  5872.             Parameters  pal - Pointer to the palette array to rotate
  5873.                         numColors - Number of colors entries in the
  5874.                         palette array
  5875.                         direction - Direction to rotate the palette
  5876.                         entries
  5877.  
  5878.  
  5879.  
  5880.  
  5881.  
  5882.  
  5883.             Chapter 6 - Console Library                               87
  5884.  
  5885.  
  5886.  
  5887.  
  5888.  
  5889.  
  5890.             Remarks     MGL_rotatePalette() rotates the values in the
  5891.                         passed palette array in the specified
  5892.                         direction. The palette may be any arbitrary
  5893.                         size, so you can rotate just a subset of the
  5894.                         values in the current physical palette. Note
  5895.                         that this routine has not effect on the
  5896.                         currently active palette. In order to make
  5897.                         the new rotated palette active you will need
  5898.                         to call the MGL_setPalette() routine.
  5899.  
  5900.                         The direction of rotation should be one of
  5901.                         the following:
  5902.  
  5903.                         PAL_ROTATE_UP   - Rotate palette entries up
  5904.                         in memory
  5905.                         PAL_ROTATE_DOWN - Rotate palette entries down
  5906.                         in memory
  5907.  
  5908.                         When the direction specified is
  5909.                         PAL_ROTATE_UP, the first entry in the palette
  5910.                         is moved to the last position in the palette,
  5911.                         and all the remaining entries are move one
  5912.                         position down in the array. The the direction
  5913.                         specified is PAL_ROTATE_DOWN, the last entry
  5914.                         is moved into the first entry of the palette,
  5915.                         and the remaining entries are all moved on
  5916.                         position up in the array.
  5917.  
  5918.             See also    MGL_setPalette(), MGL_getPalette()
  5919.  
  5920.  
  5921.             MGL_scanLeftForColor
  5922.  
  5923.             Function    Scans left in video memory for a specified
  5924.                         color
  5925.  
  5926.             Syntax      int MGL_scanLeftForColor(int x,int y,color_t
  5927.                         color);
  5928.  
  5929.             Prototype   mgraph.h
  5930.             in
  5931.  
  5932.             Parameters  x,y - Location to begin scanline search
  5933.                         color - Color value to search for
  5934.  
  5935.  
  5936.  
  5937.  
  5938.  
  5939.  
  5940.  
  5941.  
  5942.  
  5943.  
  5944.  
  5945.  
  5946.  
  5947.  
  5948.  
  5949.  
  5950.             88                      MegaGraph Graphics Library Reference
  5951.  
  5952.  
  5953.  
  5954.  
  5955.  
  5956.  
  5957.             Remarks     MGL_scanLeftForColor() begins scanning in
  5958.                         video memory at the specified location for
  5959.                         the specified color. The search begins at the
  5960.                         location (x,y) and searches left along the
  5961.                         scanline from this point and returns the x
  5962.                         coordinate of the pixel if one is found, or -
  5963.                         1 if the search went beyond the left edge of
  5964.                         the display screen.
  5965.  
  5966.                         No clipping or viewport mapping is performed
  5967.                         by this routine, but can be performed after
  5968.                         calling this routine. This routine can be
  5969.                         used as the basis of a high performance
  5970.                         floodfill operation. Have a look in the file
  5971.                         FFILL.C in the EXAMPLES directory which uses
  5972.                         this routine to implement a fast floodfill
  5973.                         operation.
  5974.  
  5975.             Return      X coordinate of pixel if found, or -1 if
  5976.             value       search hit left edge of display
  5977.  
  5978.             See also    MGL_scanRightForColor(),
  5979.                         MGL_scanLeftWhileColor(),
  5980.                         MGL_scanRightWhileColor()
  5981.  
  5982.  
  5983.             MGL_scanLeftWhileColor
  5984.  
  5985.             Function    Scans left in video memory for any color but
  5986.                         the specified color
  5987.  
  5988.             Syntax      int MGL_scanLeftWhileColor(int x,int
  5989.                         y,color_t color);
  5990.  
  5991.             Prototype   mgraph.h
  5992.             in
  5993.  
  5994.             Parameters  x,y - Location to begin scanline search
  5995.                         color - Color value to search on
  5996.  
  5997.  
  5998.  
  5999.  
  6000.  
  6001.  
  6002.  
  6003.  
  6004.  
  6005.  
  6006.  
  6007.  
  6008.  
  6009.  
  6010.  
  6011.  
  6012.  
  6013.  
  6014.  
  6015.  
  6016.  
  6017.             Chapter 6 - Console Library                               89
  6018.  
  6019.  
  6020.  
  6021.  
  6022.  
  6023.  
  6024.             Remarks     MGL_scanLeftWhileColor() begins scanning in
  6025.                         video memory at the specified location and
  6026.                         continues to scan while the pixels are the
  6027.                         same as the specified seed color. The search
  6028.                         begins at the location (x,y) and searches
  6029.                         left along the scanline from this point and
  6030.                         returns the x coordinate of the first pixel
  6031.                         found that is not of the specified color, or
  6032.                         -1 if the search went beyond the left edge of
  6033.                         the display screen.
  6034.  
  6035.                         No clipping or viewport mapping is performed
  6036.                         by this routine, but can be performed after
  6037.                         calling this routine. This routine can be
  6038.                         used as the basis of a high performance
  6039.                         floodfill operation. Have a look in the file
  6040.                         FFILL.C in the EXAMPLES directory which uses
  6041.                         this routine to implement a fast floodfill
  6042.                         operation.
  6043.  
  6044.             Return      X coordinate of pixel if found, -1 if search
  6045.             value       hit left edge of display
  6046.  
  6047.             See also    MGL_scanLeftForColor(),
  6048.                         MGL_scanRightForColor(),
  6049.                         MGL_scanRightWhileColor()
  6050.  
  6051.  
  6052.             MGL_scanLine
  6053.  
  6054.             Function    Fills a specified scanline
  6055.  
  6056.             Syntax      void MGL_scanLine(int y,int x1,int x2);
  6057.  
  6058.             Prototype   mgraph.h
  6059.             in
  6060.  
  6061.             Parameters  y - Y coordinate of scanline to fill
  6062.                         x1 - Starting X coordinate of scanline to
  6063.                         fill
  6064.                         x2 - Ending X coordinate of scanline to fill
  6065.  
  6066.             Remarks     MGL_scanLine() fills the specified portion of
  6067.                         a scanline in the current attributes and fill
  6068.                         pattern. This can be used to implement higher
  6069.                         level complex fills, such as region fills,
  6070.                         floodfills etc.
  6071.  
  6072.             See also    MGL_penStyle(), MGL_setPenBitmapPattern(),
  6073.                         MGL_setPenPixmapPattern()
  6074.  
  6075.  
  6076.  
  6077.  
  6078.  
  6079.  
  6080.  
  6081.  
  6082.  
  6083.  
  6084.             90                      MegaGraph Graphics Library Reference
  6085.  
  6086.  
  6087.  
  6088.  
  6089.  
  6090.  
  6091.             MGL_scanRightForColor
  6092.  
  6093.             Function    Scans right in video memory for a specified
  6094.                         color
  6095.  
  6096.             Syntax      int MGL_scanRightForColor(int x,int y,color_t
  6097.                         color);
  6098.  
  6099.             Prototype   mgraph.h
  6100.             in
  6101.  
  6102.             Parameters  x,y - Location to begin scanline search
  6103.                         color - Color value to search for
  6104.  
  6105.             Remarks     MGL_scanRightForColor() begins scanning in
  6106.                         video memory at the specified location for
  6107.                         the specified color. The search begins at the
  6108.                         location (x,y) and searches right along the
  6109.                         scanline from this point and returns the x
  6110.                         coordinate of the pixel if one is found, or
  6111.                         one more than the maximum X coordinate if the
  6112.                         search went beyond the right edge of the
  6113.                         display screen.
  6114.  
  6115.                         No clipping or viewport mapping is performed
  6116.                         by this routine, but can be performed after
  6117.                         calling this routine. This routine can be
  6118.                         used as the basis of a high performance
  6119.                         floodfill operation. Have a look in the file
  6120.                         FFILL.C in the EXAMPLES directory which uses
  6121.                         this routine to implement a fast floodfill
  6122.                         operation.
  6123.  
  6124.             Return      X coordinate of pixel if found, or maxx+1 if
  6125.             value       search hit right edge of display
  6126.  
  6127.             See also    MGL_scanLeftForColor(),
  6128.                         MGL_scanLeftWhileColor(),
  6129.                         MGL_scanRightWhileColor()
  6130.  
  6131.  
  6132.             MGL_scanRightWhileColor
  6133.  
  6134.             Function    Scans right in video memory for any color but
  6135.                         the specified color
  6136.  
  6137.             Syntax      int MGL_scanRightWhileColor(int x,int
  6138.                         y,color_t color);
  6139.  
  6140.             Prototype   mgraph.h
  6141.             in
  6142.  
  6143.             Parameters  x,y - Location to begin scanline search
  6144.                         color - Color value to search on
  6145.  
  6146.  
  6147.  
  6148.  
  6149.  
  6150.  
  6151.             Chapter 6 - Console Library                               91
  6152.  
  6153.  
  6154.  
  6155.  
  6156.  
  6157.  
  6158.             Remarks     MGL_scanRightWhileColor() begins scanning in
  6159.                         video memory at the specified location and
  6160.                         continues to scan while the pixels are the
  6161.                         same as the specified seed color. The search
  6162.                         begins at the location (x,y) and searches
  6163.                         right along the scanline from this point and
  6164.                         returns the x coordinate of the first pixel
  6165.                         found that is not of the specified color, or
  6166.                         one more than the maximum X coordinate if the
  6167.                         search went beyond the right edge of the
  6168.                         display screen.
  6169.  
  6170.                         No clipping or viewport mapping is performed
  6171.                         by this routine, but can be performed after
  6172.                         calling this routine. This routine can be
  6173.                         used as the basis of a high performance
  6174.                         floodfill operation. Have a look in the file
  6175.                         FFILL.C in the EXAMPLES directory which uses
  6176.                         this routine to implement a fast floodfill
  6177.                         operation.
  6178.  
  6179.             Return      X coordinate of pixel if found, maxx+1 if
  6180.             value       search hit right edge of display
  6181.  
  6182.             See also    MGL_scanLeftForColor(),
  6183.                         MGL_scanRightForColor(),
  6184.                         MGL_scanLeftWhileColor()
  6185.  
  6186.  
  6187.             MGL_setActivePage
  6188.  
  6189.             Function    Sets the currently active hardware display
  6190.                         page.
  6191.  
  6192.             Syntax      void MGL_setActivePage(int page);
  6193.  
  6194.             Prototype   mgraph.h
  6195.             in
  6196.  
  6197.             Parameters  page - Number of active hardware display page
  6198.                         to use
  6199.  
  6200.             Remarks     MGL_setActivePage() sets the currently active
  6201.                         hardware video page number to which all
  6202.                         output from the MGL is sent to. The first
  6203.                         hardware video page is number 0, the second
  6204.                         is 1 and so on. The number of available
  6205.                         hardware video pages depends on the type of
  6206.                         underlying hardware, the video mode
  6207.                         resolution and amount of video memory
  6208.                         installed. Thus not all video modes support
  6209.                         multiple hardware video pages,
  6210.  
  6211.             See also    MGL_getActivePage(), MGL_setVisualPage(),
  6212.                         MGL_getVisualPage()
  6213.  
  6214.  
  6215.  
  6216.  
  6217.  
  6218.             92                      MegaGraph Graphics Library Reference
  6219.  
  6220.  
  6221.  
  6222.  
  6223.  
  6224.  
  6225.             MGL_setAspectRatio
  6226.  
  6227.             Function    Sets the current video modes aspect ratio
  6228.  
  6229.             Syntax      void MGL_setAspectRatio(int aspectRatio);
  6230.  
  6231.             Prototype   mgraph.h
  6232.             in
  6233.  
  6234.             Parameters  aspectRatio - New value for the aspect ratio
  6235.  
  6236.             Remarks     MGL_setAspectRatio() sets the aspect ratio of
  6237.                         the currently active output device's physical
  6238.                         pixels. This ratio is equal to:
  6239.  
  6240.                                   pixel x size
  6241.                                           1000
  6242.                                           x 
  6243.                                   pixel y size
  6244.  
  6245.                         The device aspect ratio can be used to
  6246.                         display circles and squares on the display
  6247.                         device by approximating them with ellipses
  6248.                         and rectangles of the appropriate dimensions.
  6249.                         Thus in order to determine the number of
  6250.                         pixels in the y direction for a square with
  6251.                         100 pixels in the x direction, we can simply
  6252.                         use the formula:
  6253.  
  6254.                         y_pixels = ((long)x_pixels * 1000) /
  6255.                         aspectratio
  6256.  
  6257.                         Note the cast to a long to avoid arithmetic
  6258.                         overflow, as the apsect ratio is returned as
  6259.                         an integer value with 1000 being a 1:1 aspect
  6260.                         ratio.
  6261.  
  6262.                         Normally you should not need to change the
  6263.                         aspect ratio, as the MGL will automatically
  6264.                         determine the correct aspect ratio for the
  6265.                         current display mode.
  6266.  
  6267.             See also    MGL_getAspectRatio()
  6268.  
  6269.  
  6270.             MGL_setBackColor
  6271.  
  6272.             Function    Sets the currently active background color
  6273.  
  6274.             Syntax      void MGL_setBackColor(color_t color);
  6275.  
  6276.             Prototype   mgraph.h
  6277.             in
  6278.  
  6279.             Parameters  color - New background color value
  6280.  
  6281.  
  6282.  
  6283.  
  6284.  
  6285.  
  6286.  
  6287.             Chapter 6 - Console Library                               93
  6288.  
  6289.  
  6290.  
  6291.  
  6292.  
  6293.  
  6294.             Remarks     MGL_setBackColor() sets the current
  6295.                         background color value. The background color
  6296.                         value is used to clear the display and
  6297.                         viewport with the MGL_clearDevice() and
  6298.                         MGL_clearViewport() routines, and is also
  6299.                         used for filling solid primitives in the
  6300.                         BITMAP_PATTERN_OPAQUE fill mode.
  6301.  
  6302.                         Note: The value passed to this routine is
  6303.                         either a color index or a color value in the
  6304.                         correct packed pixel format for the current
  6305.                         video mode. Use the MGL_packColor() routine
  6306.                         to pack 24 bit RGB values for direct color
  6307.                         video modes.
  6308.  
  6309.             See also    MGL_getBackColor(), MGL_setColor(),
  6310.                         MGL_getColor(), MGL_packColor()
  6311.  
  6312.  
  6313.             MGL_setBorderColors
  6314.  
  6315.             Function    Sets the current border color values.
  6316.  
  6317.             Syntax      void MGL_setBorderColors(color_t
  6318.                         bright,color_t dark);
  6319.  
  6320.             Prototype   mgraph.h
  6321.             in
  6322.  
  6323.             Parameters  bright - New value for border bright color
  6324.                         dark - New value for border dark color
  6325.  
  6326.             Remarks     MGL_setBorderColors() sets the currently
  6327.                         active border colors values. There are two
  6328.                         border color defined by the MGL, the bright
  6329.                         border color value and the      border color
  6330.                                                    dark
  6331.                         value. These values are used by the
  6332.                         MGL_drawBorder(), MGL_drawHDivider() and
  6333.                         MGL_drawVDivider() routines to determine the
  6334.                         colors to draw the psuedo 3D borders in.
  6335.                         These values will be set automatically for
  6336.                         you by default when the MGL is initisalised,
  6337.                         but you will need to change these values if
  6338.                         you modify the palette.
  6339.  
  6340.                         Note: The value passed to this routine is
  6341.                         either a color index or a color value in the
  6342.                         correct packed pixel format for the current
  6343.                         video mode. Use the MGL_packColor() routine
  6344.                         to pack 24 bit RGB values for direct color
  6345.                         video modes.
  6346.  
  6347.             See also    MGL_getBorderColors(), MGL_packColor()
  6348.  
  6349.  
  6350.  
  6351.  
  6352.  
  6353.  
  6354.  
  6355.             94                      MegaGraph Graphics Library Reference
  6356.  
  6357.  
  6358.  
  6359.  
  6360.  
  6361.  
  6362.             MGL_setBufSize
  6363.  
  6364.             Function    Sets the size of the internal MGL buffer.
  6365.  
  6366.             Syntax      void MGL_setBufSize(unsigned size);
  6367.  
  6368.             Prototype   mgraph.h
  6369.             in
  6370.  
  6371.             Parameters  size - New size of the internal MGL buffer
  6372.  
  6373.             Remarks     MGL_setBufSize() sets the size of the
  6374.                         internal MGL buffer. When the MGL is
  6375.                         rendering primitives, it needs a buffer of
  6376.                         local scratch space that it can uses for
  6377.                         temporary results while rendering the
  6378.                         primitives.
  6379.  
  6380.                         The default size of this buffer is 4096 bytes
  6381.                         and is adequate for most needs. If however
  6382.                         you attempt to render some primitives and the
  6383.                         MGL runs out of local storage space you would
  6384.                         need to increase the size of this internal
  6385.                         buffer.
  6386.  
  6387.                         This routine must be called        the MGL is
  6388.                                                     before
  6389.                         initialised for the first time.
  6390.  
  6391.             See also    MGL_init()
  6392.  
  6393.  
  6394.             MGL_setClipMode
  6395.  
  6396.             Function    Sets the clipping mode for the MGL
  6397.  
  6398.             Syntax      void MGL_setClipMode(bool mode);
  6399.  
  6400.             Prototype   mgraph.h
  6401.             in
  6402.  
  6403.             Parameters  mode - True for clipping to be turned on,
  6404.                         false for no clipping.
  6405.  
  6406.             Remarks     MGL_setClipMode() sets the current clipping
  6407.                         mode. You can selectively turn clipping on
  6408.                         and off for the MGL, in order to speed up
  6409.                         some operations. Clipping is turned on by
  6410.                         default, and generally you will want to leave
  6411.                         clipping enabled, however if you are doing
  6412.                         your own rendering and perform your own
  6413.                         clipping you may want to turn this off for
  6414.                         extra performance from the MGL.
  6415.  
  6416.             See also    MGL_getClipMode()
  6417.  
  6418.  
  6419.  
  6420.  
  6421.  
  6422.  
  6423.             Chapter 6 - Console Library                               95
  6424.  
  6425.  
  6426.  
  6427.  
  6428.  
  6429.  
  6430.             MGL_setClipRect
  6431.  
  6432.             Function    Sets the current clipping rectangle
  6433.  
  6434.             Syntax      void MGL_setClipRect(rect clip);
  6435.  
  6436.             Prototype   mgraph.h
  6437.             in
  6438.  
  6439.             Parameters  clip - New clipping rectangle to be used.
  6440.  
  6441.             Remarks     MGL_setClipRect() sets the current clipping
  6442.                         rectangle coordinates. The current clipping
  6443.                         rectangle is used to clip all output, and is
  6444.                         always defined as being relative to the
  6445.                         currently active viewport The clipping
  6446.                         rectangle can be no larger than the currently
  6447.                         active viewport, and will be truncated if an
  6448.                         attempt it made to allow clipping outside of
  6449.                         the active viewport.
  6450.  
  6451.             See also    MGL_getClipRect, MGL_setViewport(),
  6452.                         MGL_getViewport()
  6453.  
  6454.  
  6455.             MGL_setColor
  6456.  
  6457.             Function    Sets the current foreground color
  6458.  
  6459.             Syntax      void MGL_setColor(color_t color);
  6460.  
  6461.             Prototype   mgraph.h
  6462.             in
  6463.  
  6464.             Parameters  color - New foreground color value
  6465.  
  6466.             Remarks     MGL_setColor() sets the current foreground
  6467.                         color values. The foreground color value is
  6468.                         used to draw all primitives.
  6469.  
  6470.                         Note: The value passed to this routine is
  6471.                         either a color index or a color value in the
  6472.                         correct packed pixel format for the current
  6473.                         video mode. Use the MGL_packColor() routine
  6474.                         to pack 24 bit RGB values for direct color
  6475.                         video modes.
  6476.  
  6477.             See also    MGL_getColor(), MGL_setBackColor(),
  6478.                         MGL_getBackColor(), MGL_packColor()
  6479.  
  6480.  
  6481.  
  6482.  
  6483.  
  6484.  
  6485.  
  6486.  
  6487.  
  6488.  
  6489.  
  6490.             96                      MegaGraph Graphics Library Reference
  6491.  
  6492.  
  6493.  
  6494.  
  6495.  
  6496.  
  6497.             MGL_setCursorColor
  6498.  
  6499.             Function    Sets the current mouse cursor color.
  6500.  
  6501.             Syntax      void MGL_setCursorColor(color_t color);
  6502.  
  6503.             Prototype   mgraph.h
  6504.             in
  6505.  
  6506.             Parameters  color - New mouse cursor color value
  6507.  
  6508.             Remarks     MGL_setCursorColor() sets the currently
  6509.                         active mouse cursor color. The mouse cursor
  6510.                         color is used to determine what foreground
  6511.                         color is used to draw the mouse cursor in.
  6512.  
  6513.                         Note: The value passed to this routine is
  6514.                         either a color index or a color value in the
  6515.                         correct packed pixel format for the current
  6516.                         video mode. Use the MGL_packColor() routine
  6517.                         to pack 24 bit RGB values for direct color
  6518.                         video modes.
  6519.  
  6520.             See also    MGL_getCursorColor(), MGL_packColor()
  6521.  
  6522.  
  6523.             MGL_setDefaultPalette
  6524.  
  6525.             Function    Resets the palette to the MGL defaut values.
  6526.  
  6527.             Syntax      void MGL_setDefaultPalette(void);
  6528.  
  6529.             Prototype   mgraph.h
  6530.             in
  6531.  
  6532.             Remarks     MGL_setDefaultPalette() sets the palette to
  6533.                         the current MGL default values for the
  6534.                         current video mode. This can be used to reset
  6535.                         the palette to the original default values
  6536.                         that the palette is programmed with when the
  6537.                         MGL is initialised.
  6538.  
  6539.             See also    MGL_getDefaultPalette(), MGL_setPalette(),
  6540.                         MGL_getPalette()
  6541.  
  6542.  
  6543.             MGL_setGraphMode
  6544.  
  6545.             Function    Restarts graphics mode operation.
  6546.  
  6547.             Syntax      void MGL_setGraphMode(void);
  6548.  
  6549.             Prototype   mgraph.h
  6550.             in
  6551.  
  6552.  
  6553.  
  6554.  
  6555.  
  6556.  
  6557.             Chapter 6 - Console Library                               97
  6558.  
  6559.  
  6560.  
  6561.  
  6562.  
  6563.  
  6564.             Remarks     MGL_setGraphMode() restarts the graphics mode
  6565.                         operation of the MGL after MGL_restoreCRTMode
  6566.                         has been called to put the system back into
  6567.                         the original text mode. To start the graphics
  6568.                         mode initialially, you call the MGL_int()
  6569.                         routine.
  6570.  
  6571.             See also    MGL_restoreCRTMode(), MGL_init()
  6572.  
  6573.  
  6574.             MGL_setMarkerColor
  6575.  
  6576.             Function    Sets the current marker color value.
  6577.  
  6578.             Syntax      void MGL_setMarkerColor(color_t color);
  6579.  
  6580.             Prototype   mgraph.h
  6581.             in
  6582.  
  6583.             Parameters  color - New marker color to set
  6584.  
  6585.             Remarks     MGL_setMarkerColor() sets the current marker
  6586.                         color value. The marker color is used when
  6587.                         drawing markers with the MGL_marker()
  6588.                         routine.
  6589.  
  6590.                         Note: The value passed to this routine is
  6591.                         either a color index or a color value in the
  6592.                         correct packed pixel format for the current
  6593.                         video mode. Use the MGL_packColor() routine
  6594.                         to pack 24 bit RGB values for direct color
  6595.                         video modes.
  6596.  
  6597.             See also    MGL_getMarkerColor(), MGL_marker(),
  6598.                         MGL_polyMarker(), MGL_packColor()
  6599.  
  6600.  
  6601.             MGL_setMarkerSize
  6602.  
  6603.             Function    Sets the current marker size value.
  6604.  
  6605.             Syntax      void MGL_setMarkerSize(int size);
  6606.  
  6607.             Prototype   mgraph.h
  6608.             in
  6609.  
  6610.             Parameters  size - New marker size
  6611.  
  6612.             Remarks     MGL_setMarkerSize() sets the current marker
  6613.                         size. The marker size is used to determine
  6614.                         how big to draw the markers that are drawn
  6615.                         with the MGL_marker() routine. The size is
  6616.                         defined as dimension from the middle of the
  6617.                         marker to the edges, so the actual dimensions
  6618.                         of the marker will be approximately twice the
  6619.                         maker size. If marker size of 1 will define a
  6620.                         marker that is contained within a rectangle 3
  6621.                         pixels wide.
  6622.  
  6623.  
  6624.             98                      MegaGraph Graphics Library Reference
  6625.  
  6626.  
  6627.  
  6628.  
  6629.  
  6630.  
  6631.  
  6632.             See also    MGL_getMarkerSize(), MGL_marker(),
  6633.                         MGL_polyMarker()
  6634.  
  6635.  
  6636.             MGL_setMarkerStyle
  6637.  
  6638.             Function    Sets the current marker style.
  6639.  
  6640.             Syntax      void MGL_setMarkerStyle(int style);
  6641.  
  6642.             Prototype   mgraph.h
  6643.             in
  6644.  
  6645.             Parameters  style - New marker style value.
  6646.  
  6647.             Remarks     MGL_setMarkerStyle() sets the current marker
  6648.                         style value. The marker style defines the
  6649.                         type of marker to be rendered. Currently the
  6650.                         MGL defines the following markers:
  6651.  
  6652.                         MARKER_SQUARE - A solid square
  6653.                         MARKER_CIRCLE - A solid circle
  6654.                         MARKER_X      - A cross made of two lines
  6655.  
  6656.             See also    MGL_getMarkerStyle(), MGL_marker(),
  6657.                         MGL_polyMarker()
  6658.  
  6659.  
  6660.             MGL_setPalette
  6661.  
  6662.             Function    Sets the currently active palette values.
  6663.  
  6664.             Syntax      void MGL_setPalette(palette *pal,int
  6665.                         numColors,int startIndex);
  6666.  
  6667.             Prototype   mgraph.h
  6668.             in
  6669.  
  6670.             Parameters  pal - Pointer to array of palette values to
  6671.                         program
  6672.                         numColors - Number of colors to program from
  6673.                         the array
  6674.                         startIndex - Starting index to program from
  6675.                         in the array
  6676.  
  6677.  
  6678.  
  6679.  
  6680.  
  6681.  
  6682.  
  6683.  
  6684.  
  6685.  
  6686.  
  6687.  
  6688.  
  6689.  
  6690.  
  6691.             Chapter 6 - Console Library                               99
  6692.  
  6693.  
  6694.  
  6695.  
  6696.  
  6697.  
  6698.             Remarks     MGL_setPalette() sets part or all of the
  6699.                         currently active palette given the values
  6700.                         passed in the array    . You can specify only
  6701.                                             pal
  6702.                         a subset of the palette values to be modified
  6703.                         with the startIndex and numColors arguments.
  6704.  
  6705.                         Thus to set the entire palette in a 256 color
  6706.                         video mode, you would use:
  6707.  
  6708.                             MGL_setPalette(pal,255,0);
  6709.  
  6710.                         or to set the top half of the palette you
  6711.                         would use:
  6712.  
  6713.                             MGL_setPalette(pal,128,128);
  6714.  
  6715.                         Note that the MGL will ensure that the
  6716.                         palette is programmed without snow depending
  6717.                         on the value of the current snow level
  6718.                         defined by calling the
  6719.                         MGL_setPaletteSnowLevel() routine, and will
  6720.                         wait for the start of a vertical retrace
  6721.                         before the first entry is programmed.
  6722.  
  6723.             See also    MGL_getPalette(), MGL_setPaletteEntry(),
  6724.                         MGL_setPaletteSnowLevel(),
  6725.                         MGL_getPaletteSnowLevel()
  6726.  
  6727.  
  6728.  
  6729.             MGL_setPaletteEntry
  6730.  
  6731.             Function
  6732.  
  6733.             Syntax      void MGL_setPaletteEntry(int entry,uchar
  6734.                         red,uchar green,uchar blue);
  6735.  
  6736.             Prototype   mgraph.h
  6737.             in
  6738.  
  6739.             Parameters  entry - Palette index to program
  6740.                         red - Red component for palette entry
  6741.                         green - Green component for palette entry
  6742.                         blue - Blue component for palette entry
  6743.  
  6744.             Remarks     MGL_setPaletteEntry() sets the color values
  6745.                         of a single palette entry. If you wish to set
  6746.                         more than a single palette index you should
  6747.                         use the MGL_setPalette() routine which is
  6748.                         faster for multiple entries. The main reason
  6749.                         for this is that this routine will wait for a
  6750.                         vertical retrace before the palette entry is
  6751.                         programmed to ensure that snow does not
  6752.                         occur.
  6753.  
  6754.             See also    MGL_getPaletteEntry(), MGL_setPalette(),
  6755.                         MGL_getPalette()
  6756.  
  6757.  
  6758.  
  6759.             100                     MegaGraph Graphics Library Reference
  6760.  
  6761.  
  6762.  
  6763.  
  6764.  
  6765.  
  6766.             MGL_setPaletteSnowLevel
  6767.  
  6768.             Function    Sets the current palette snow level
  6769.  
  6770.             Syntax      void MGL_setPaletteSnowLevel(int level);
  6771.  
  6772.             Prototype   mgraph.h
  6773.             in
  6774.  
  6775.             Parameters  level - New snow level
  6776.  
  6777.             Remarks     MGL_setPaletteSnowLevel() sets the number of
  6778.                         palette entries that can be programmed during
  6779.                         a single vertical retrace before the onset of
  6780.                         snow. The MGL uses a reasonable default of
  6781.                         100 entries per retrace, but you may want to
  6782.                         modify this on faster or slower machines
  6783.                         (this should be a user option). In the future
  6784.                         the MGL will automatically determine the
  6785.                         optimum value for this at initialisation
  6786.                         time.
  6787.  
  6788.             See also    MGL_getPaletteSnowLevel(), MGL_setPalette()
  6789.  
  6790.  
  6791.             MGL_setPenBitmapPattern
  6792.  
  6793.             Function    Sets the currently active bitmap pattern.
  6794.  
  6795.             Syntax      void MGL_setPenBitmapPattern(pattern *pat);
  6796.  
  6797.             Prototype   mgraph.h
  6798.             in
  6799.  
  6800.             Parameters  pat - New bitmap pattern to use.
  6801.  
  6802.             Remarks     MGL_setPenBitmapPattern() sets the currently
  6803.                         active bitmap pattern used when rendering
  6804.                         patterned primitive in the
  6805.                         BITMAP_PATTERN_TRANSPARENT and
  6806.                         BITMAP_PATTERN_OPQAUE pen styles. A bitmap
  6807.                         pattern is defined as an 8 x 8 pixel bitmap
  6808.                         pattern stored as an array of 8 bytes. The
  6809.                         pattern value is copied from the passed
  6810.                         structure.
  6811.  
  6812.                         When filling in the
  6813.                         BITMAP_PATTERN_TRANSPARENT mode, the
  6814.                         foreground color is used to fill in all
  6815.                         pixels in the bitmap pattern that are a 1.
  6816.                         Where the pixels in the bitmap pattern are a
  6817.                         0, the original background color is retained.
  6818.                         In the BITMAP_PATTERN_OPAQUE mode, the
  6819.                         background color is used to fill in the
  6820.                         pixels in the bitmap that are set to a 0.
  6821.  
  6822.             See also    MGL_getPenBitmapPattern(), MGL_setPenStyle(),
  6823.                         MGL_getPenStyle()
  6824.  
  6825.  
  6826.             Chapter 6 - Console Library                              101
  6827.  
  6828.  
  6829.  
  6830.  
  6831.  
  6832.  
  6833.  
  6834.  
  6835.             MGL_setPenSize
  6836.  
  6837.             Function    Sets the current pen size
  6838.  
  6839.             Syntax      void MGL_setPenSize(int height,int width);
  6840.  
  6841.             Prototype   mgraph.h
  6842.             in
  6843.  
  6844.             Parameters  height - Height of the pen in pixels
  6845.                         width - Width of the pen in pixels
  6846.  
  6847.             Remarks     MGL_setPenSize() sets the size of the current
  6848.                         pen in pixels. The default pen is 1 pixel by
  6849.                         1 pixel in dimensions, however you can change
  6850.                         this to whatever value you like. When
  6851.                         primitive are rendered with a pen other than
  6852.                         the default, the pixels in the pen always lie
  6853.                         to the right and below the current pen
  6854.                         position.
  6855.  
  6856.             See also    MGL_getPenSize()
  6857.  
  6858.  
  6859.             MGL_setPenStyle
  6860.  
  6861.             Function    Sets the current pen style
  6862.  
  6863.             Syntax      void MGL_setPenStyle(int style);
  6864.  
  6865.             Prototype   mgraph.h
  6866.             in
  6867.  
  6868.             Parameters  style - New pen style to use.
  6869.  
  6870.             Remarks     MGL_getPenStyle() returns the currently
  6871.                         active pen style. The MGL supports the
  6872.                         following pen styles:
  6873.  
  6874.                         SOLID_PATTERN              - Fill with solid
  6875.                         color
  6876.                         BITMAP_PATTERN_OPAQUE      - Pattern fill
  6877.                         BITMAP_PATTERN_TRANSPARENT - Transparent
  6878.                         pattern fill
  6879.  
  6880.                         When filling in the
  6881.                         BITMAP_PATTERN_TRANSPARENT mode, the
  6882.                         foreground color is used to fill in all
  6883.                         pixels in the bitmap pattern that are a 1.
  6884.                         Where the pixels in the bitmap pattern are a
  6885.                         0, the original background color is retained.
  6886.                         In the BITMAP_PATTERN_OPAQUE mode, the
  6887.                         background color is used to fill in the
  6888.                         pixels in the bitmap that are set to a 0.
  6889.  
  6890.             See also    MGL_getPenStyle(), MGL_setPenBitmapPattern()
  6891.  
  6892.  
  6893.             102                     MegaGraph Graphics Library Reference
  6894.  
  6895.  
  6896.  
  6897.  
  6898.  
  6899.  
  6900.  
  6901.  
  6902.             MGL_setPolygonType
  6903.  
  6904.             Function    Sets the current polygon type
  6905.  
  6906.             Syntax      void MGL_setPolygonType(int type);
  6907.  
  6908.             Prototype   mgraph.h
  6909.             in
  6910.  
  6911.             Parameters  type - New polygon type
  6912.  
  6913.             Remarks     MGL_setPolygonType() sets the current polygon
  6914.                         type. You can change this value to force the
  6915.                         MGL to work with a specific polygon type (and
  6916.                         to avoid the default automatic polygon type
  6917.                         checking). The MGL supports the following
  6918.                         polygon types:
  6919.  
  6920.                         AUTO_POLYGON    - MGL automatically
  6921.                         determines type
  6922.                         CONVEX_POLYGON  - All polygons rendered as
  6923.                         convex
  6924.                         COMPLEX_POLYGON - All polygons rendered as
  6925.                         complex
  6926.  
  6927.                         If you expect to be drawing lots of complex
  6928.                         or convex polygons, setting the polygon type
  6929.                         can result in faster polygon rendering.
  6930.  
  6931.             See also    MGL_getPolygonType(), MGL_fillPolygon()
  6932.  
  6933.  
  6934.             MGL_setRelViewport
  6935.  
  6936.             Function    Sets a viewport relative to the current one
  6937.  
  6938.             Syntax      void MGL_setRelViewport(rect view);
  6939.  
  6940.             Prototype   mgraph.h
  6941.             in
  6942.  
  6943.             Parameters  view - Bounding rectangle for the new
  6944.                         viewport.
  6945.  
  6946.             Remarks     MGL_setRelViewport() sets the current
  6947.                         viewport to the viewport specified by view,
  6948.                         where view is relative to the currently
  6949.                         active viewport. The new viewport is
  6950.                         restricted to fall within the bounds of the
  6951.                         currently active viewport.
  6952.  
  6953.                         All output in the MGL is relative to the
  6954.                         current viewport, so by changing the viewport
  6955.                         to a new value you can make all output appear
  6956.                         in a different rectangular portion of the
  6957.                         video display.
  6958.  
  6959.  
  6960.             Chapter 6 - Console Library                              103
  6961.  
  6962.  
  6963.  
  6964.  
  6965.  
  6966.  
  6967.  
  6968.             See also    MGL_getViewport(), MGL_setViewport(),
  6969.                         MGL_clearViewport(), MGL_setClipRect()
  6970.  
  6971.  
  6972.             MGL_setResult
  6973.  
  6974.             Function    Sets the internal MGL result flag.
  6975.  
  6976.             Syntax      void MGL_setResult(int result)
  6977.  
  6978.             Prototype   mgraph.h
  6979.             in
  6980.  
  6981.             Parameters  result - New internal result flag
  6982.  
  6983.             Remarks     MGL_setResult() sets the internal MGL result
  6984.                         flag to the specified value. This routine is
  6985.                         primarily for extension libraries, but you
  6986.                         can use it to add your own extension
  6987.                         functions to the MGL that will return result
  6988.                         codes in the same manner as the MGL.
  6989.  
  6990.             See also    MGL_getResult()
  6991.  
  6992.  
  6993.             MGL_setSpaceExtra
  6994.  
  6995.             Function    Sets the current space extra value.
  6996.  
  6997.             Syntax      void MGL_setSpaceExtra(int extra);
  6998.  
  6999.             Prototype   mgraph.h
  7000.             in
  7001.  
  7002.             Parameters  extra - New space extra value.
  7003.  
  7004.             Remarks     MGL_setSpaceExtra() sets the current space
  7005.                         extra value used when drawing text in the
  7006.                         current font. The space extra vaue is
  7007.                         normally zero, but can be a positive or
  7008.                         negative value. This value can be used to
  7009.                         insert extra space between the characters in
  7010.                         a font (making this value a large negative
  7011.                         value will make the characters run on top of
  7012.                         each other).
  7013.  
  7014.             See also    MGL_getSpaceExtra(), MGL_drawStr()
  7015.  
  7016.  
  7017.  
  7018.  
  7019.  
  7020.  
  7021.  
  7022.  
  7023.  
  7024.  
  7025.  
  7026.  
  7027.             104                     MegaGraph Graphics Library Reference
  7028.  
  7029.  
  7030.  
  7031.  
  7032.  
  7033.  
  7034.             MGL_setTextDirection
  7035.  
  7036.             Function    Sets the current text direction
  7037.  
  7038.             Syntax      void MGL_setTextDirection(int direction);
  7039.  
  7040.             Prototype   mgraph.h
  7041.             in
  7042.  
  7043.             Parameters  direction - New text direction value
  7044.  
  7045.             Remarks     MGL_setTextDirection() sets the current text
  7046.                         direction. The MGL supports the following
  7047.                         text directions:
  7048.  
  7049.                         LEFT_DIR  - Text runs to the left (right to
  7050.                         left)
  7051.                         UP_DIR    - Text runs in the up direction
  7052.                         RIGHT_DIR - Text runs to the right (left to
  7053.                         right)
  7054.                         DOWN_DIR  - Text runs in the down direction
  7055.  
  7056.                         Currently the MGL only supports directional
  7057.                         text with the default 8x8 bitmap font and
  7058.                         vector fonts. Bitmap fonts can only be drawn
  7059.                         in the RIGHT_DIR direction.
  7060.  
  7061.             See also    MGL_getTextDirection(), MGL_drawStr()
  7062.  
  7063.  
  7064.             MGL_setTextJustify
  7065.  
  7066.             Function    Sets the current text horizontal and vertical
  7067.                         justification
  7068.  
  7069.             Syntax      void MGL_setTextJustify(int horiz,int vert);
  7070.  
  7071.             Prototype   mgraph.h
  7072.             in
  7073.  
  7074.             Parameters  horiz - New horiztonal text justification
  7075.                         value
  7076.                         vert - New vertical text justification value
  7077.  
  7078.  
  7079.  
  7080.  
  7081.  
  7082.  
  7083.  
  7084.  
  7085.  
  7086.  
  7087.  
  7088.  
  7089.  
  7090.  
  7091.  
  7092.  
  7093.  
  7094.             Chapter 6 - Console Library                              105
  7095.  
  7096.  
  7097.  
  7098.  
  7099.  
  7100.  
  7101.             Remarks     MGL_setTextJustify() sets the current text
  7102.                         justification values. The MGL supports the
  7103.                         following horizontal justification types:
  7104.  
  7105.                         LEFT_TEXT     - Text is left justified
  7106.                         CENTER_TEXT   - Text is centered left to
  7107.                         right
  7108.                         RIGHT_TEXT    - Text is right justified
  7109.  
  7110.                         and the following vertical justification
  7111.                         types:
  7112.  
  7113.                         TOP_TEXT      - Text is top justified
  7114.                         CENTER_TEXT   - Text is centered top to
  7115.                         bottom
  7116.                         BASELINE_TEXT - Text is justified to the
  7117.                         baseline
  7118.                         BOTTOM_TEXT   - Text is bottom justified
  7119.  
  7120.             See also    MGL_getTextJustify()
  7121.  
  7122.  
  7123.             MGL_setTextSettings
  7124.  
  7125.             Function    Restores the current text settings.
  7126.  
  7127.             Syntax      void MGL_setTextSettings(text_settings
  7128.                         *settings);
  7129.  
  7130.             Prototype   mgraph.h
  7131.             in
  7132.  
  7133.             Parameters  settings - Text settings to restore
  7134.  
  7135.  
  7136.  
  7137.  
  7138.  
  7139.  
  7140.  
  7141.  
  7142.  
  7143.  
  7144.  
  7145.  
  7146.  
  7147.  
  7148.  
  7149.  
  7150.  
  7151.  
  7152.  
  7153.  
  7154.  
  7155.  
  7156.  
  7157.  
  7158.  
  7159.  
  7160.  
  7161.             106                     MegaGraph Graphics Library Reference
  7162.  
  7163.  
  7164.  
  7165.  
  7166.  
  7167.  
  7168.             Remarks     MGL_setTextSettings() restores a set of
  7169.                         previously saved text settings. This routine
  7170.                         is provides a way to save and restore all the
  7171.                         values relating to the rendering of text in
  7172.                         the MGL with a single function call. The text
  7173.                         settings values are stored in the following
  7174.                         structure:
  7175.  
  7176.                         typedef struct {
  7177.                             int             horiz_just;
  7178.                             int             vert_just;
  7179.                             int             dir;
  7180.                             int             sz_numerx;
  7181.                             int             sz_numery;
  7182.                             int             sz_denomx;
  7183.                             int             sz_denomy;
  7184.                             int             space_extra;
  7185.                             font            *fnt;
  7186.  
  7187.                         where horiz_just     vert_just
  7188.                                          and           define the
  7189.                         horizontal and vertical justification values,
  7190.                             defines the current text direction,
  7191.                         dir
  7192.                         space_extra defines the current space extra
  7193.                         value and     define the currently active
  7194.                                   fnt
  7195.                         font (stored in system memory). The
  7196.                         sz_numerx, sz_numery, sz_demonx and sz_denomy
  7197.                         specify the current text scaling factors.
  7198.  
  7199.             See also    MGL_getTextSettings()
  7200.  
  7201.  
  7202.             MGL_setTextSize
  7203.  
  7204.             Function    Sets the current text scaling factors
  7205.  
  7206.             Syntax      void MGL_setTextSize(int numerx,int
  7207.                         denomx,int numery,int denomy);
  7208.  
  7209.             Prototype   mgraph.h
  7210.             in
  7211.  
  7212.             Parameters  numerx - X scaling numerator value
  7213.                         denomx - X scaling denominator value
  7214.                         numery - Y scaling numerator value
  7215.                         denomy - Y scaling denominator value
  7216.  
  7217.             Remarks     MGL_setTextSize() sets the current text
  7218.                         scaling factors used by the MGL. The text
  7219.                         size values define an integer scaling factor
  7220.                         to be used, where the actual values will be
  7221.                         computed using the following formula:
  7222.  
  7223.                                   scaled
  7224.                                        unscaled
  7225.                                              numer
  7226.                                           denom
  7227.  
  7228.                         Note: Currently the MGL can only scale
  7229.                         vectors fonts.
  7230.  
  7231.  
  7232.  
  7233.             Chapter 6 - Console Library                              107
  7234.  
  7235.  
  7236.  
  7237.  
  7238.  
  7239.  
  7240.             See also    MGL_getTextSize()
  7241.  
  7242.  
  7243.             MGL_setViewport
  7244.  
  7245.             Function    Sets the currently active viewport
  7246.  
  7247.             Syntax      void MGL_setViewport(rect view);
  7248.  
  7249.             Prototype   mgraph.h
  7250.             in
  7251.  
  7252.             Parameters  view - New global viewport bounding rectangle
  7253.  
  7254.             Remarks     MGL_setViewport() sets the dimensions of the
  7255.                         currently active viewport. These dimensions
  7256.                         are global to the entire display area used by
  7257.                         the currently active video device driver.
  7258.  
  7259.                         All output in the MGL is relative to the
  7260.                         current viewport, so by changing the viewport
  7261.                         to a new value you can make all output appear
  7262.                         in a different rectangular portion of the
  7263.                         video display.
  7264.  
  7265.             See also    MGL_getViewport(), MGL_setRelViewport(),
  7266.                         MGL_clearViewport(), MGL_setClipRect()
  7267.  
  7268.  
  7269.             MGL_setVisualPage
  7270.  
  7271.             Function    Sets the currently visible hardware video
  7272.                         page.
  7273.  
  7274.             Syntax      int MGL_setVisualPage(int page);
  7275.  
  7276.             Prototype   mgraph.h
  7277.             in
  7278.  
  7279.             Parameters  page - New visible hardware page number
  7280.  
  7281.             Remarks     MGL_setVisualPage() sets the currently
  7282.                         visible hardware video page number. The first
  7283.                         hardware video page is number 0, the second
  7284.                         is 1 and so on. The number of available
  7285.                         hardware video pages depends on the type of
  7286.                         underlying hardware, the video mode
  7287.                         resolution and amount of video memory
  7288.                         installed. Thus not all video modes support
  7289.                         multiple hardware video pages.
  7290.  
  7291.             See also    MGL_getVisualPage(), MGL_getActivePage(),
  7292.                         MGL_setActivePage().
  7293.  
  7294.  
  7295.  
  7296.  
  7297.  
  7298.  
  7299.  
  7300.             108                     MegaGraph Graphics Library Reference
  7301.  
  7302.  
  7303.  
  7304.  
  7305.  
  7306.  
  7307.             MGL_setWriteMode
  7308.  
  7309.             Function    Sets the current write mode operation
  7310.  
  7311.             Syntax      int MGL_setWriteMode(int mode);
  7312.  
  7313.             Prototype   mgraph.h
  7314.             in
  7315.  
  7316.             Parameters  mode - New write mode operation to use
  7317.  
  7318.             Remarks     MGL_setWriteMode() sets the currently active
  7319.                         write mode. The MGL supports the following
  7320.                         write mode operations for all output
  7321.                         primitives:
  7322.  
  7323.                         REPLACE_MODE - Replace the original pixels
  7324.                         AND_MODE     - Logical AND with original
  7325.                         pixels
  7326.                         OR_MODE      - Logical OR with original
  7327.                         pixels
  7328.                         XOR_MODE     - Logical XOR with original
  7329.                         pixels
  7330.  
  7331.             See also    MGL_getWriteMode()
  7332.  
  7333.  
  7334.             MGL_singleBuffer
  7335.  
  7336.             Function    Returns the system back to single buffered
  7337.                         mode.
  7338.  
  7339.             Syntax      void MGL_singleBuffer(void);
  7340.  
  7341.             Prototype   mgraph.h
  7342.             in
  7343.  
  7344.             Remarks     MGL_singleBuffer   puts the system back into
  7345.                                         ()
  7346.                         single buffer mode. The active display page
  7347.                         is made to be the same as the current visual
  7348.                         display page for hardware double buffering.
  7349.                         This may or may not be the first hardware
  7350.                         video page.
  7351.  
  7352.             See also    MGL_doubleBuffer(), MGL_swapBuffers()
  7353.  
  7354.  
  7355.             MGL_sizex
  7356.  
  7357.             Function    Returns the total device x coordinate
  7358.                         dimensions
  7359.  
  7360.             Syntax      int MGL_sizex(void);
  7361.  
  7362.             Prototype   mgraph.h
  7363.             in
  7364.  
  7365.  
  7366.  
  7367.  
  7368.             Chapter 6 - Console Library                              109
  7369.  
  7370.  
  7371.  
  7372.  
  7373.  
  7374.  
  7375.             Remarks     MGL_sixex() returns the total number of
  7376.                         pixels available along the X coordinate axis
  7377.                         for the currently active output device. This
  7378.                         is different to the MGL_maxx() routine which
  7379.                         returns the dimensions of the currently
  7380.                         active viewport.
  7381.  
  7382.             Return      Number of pixels in X direction for entire
  7383.             value       device - 1
  7384.  
  7385.             See also    MGL_sizey(), MGL_maxx(), MGL_maxy()
  7386.  
  7387.  
  7388.             MGL_sizey
  7389.  
  7390.             Function    Returns the total device y coordinate
  7391.                         dimensions
  7392.  
  7393.             Syntax      int MGL_sizey(void);
  7394.  
  7395.             Prototype   mgraph.h
  7396.             in
  7397.  
  7398.             Remarks     MGL_sixey() returns the total number of
  7399.                         pixels available along the Y coordinate axis
  7400.                         for the currently active output device. This
  7401.                         is different to the MGL_maxy() routine which
  7402.                         returns the dimensions of the currently
  7403.                         active viewport.
  7404.  
  7405.             Return      Number of pixels in Y direction for entire
  7406.             value       device - 1
  7407.  
  7408.             See also    MGL_sizex(), MGL_maxx(), MGL_maxy()
  7409.  
  7410.  
  7411.             MGL_swapBuffers
  7412.  
  7413.             Function    Swaps the currently active front and back
  7414.                         buffers
  7415.  
  7416.             Syntax      void MGL_swapBuffers(void);
  7417.  
  7418.             Prototype   mgraph.h
  7419.             in
  7420.  
  7421.             Remarks     MGL_swapBuffers() swaps the currently active
  7422.                         front and back buffers. This routine should
  7423.                         only be called after the MGL_doubleBuffer()
  7424.                         routine has been called to initialise the
  7425.                         double buffering. Once double buffering has
  7426.                         been set up, all output from the MGL will go
  7427.                         to the current offscreen buffer, and the
  7428.                         output can be made visible with the
  7429.                         MGL_swapBuffers() routine. This routine is
  7430.                         normally used to achieve smooth animation for
  7431.                         complex scenes.
  7432.  
  7433.  
  7434.  
  7435.             110                     MegaGraph Graphics Library Reference
  7436.  
  7437.  
  7438.  
  7439.  
  7440.  
  7441.  
  7442.             See also    MGL_doubleBuffer(), MGL_singleBuffer()
  7443.  
  7444.  
  7445.             MGL_textHeight
  7446.  
  7447.             Function    Returns the height of the current font in
  7448.                         pixels
  7449.  
  7450.             Syntax      int MGL_textHeight(void);
  7451.  
  7452.             Prototype   mgraph.h
  7453.             in
  7454.  
  7455.             Remarks     MGL_textHeight() returns the height of the
  7456.                         currently active font in pixels. This
  7457.                         includes any scaling transformations that are
  7458.                         applied to the font and will be as accurate
  7459.                         as possible at the resolution of the display
  7460.                         device.
  7461.  
  7462.             Return      Height of the current font in pixels
  7463.             value
  7464.  
  7465.             See also    MGL_textWidth(), MGL_drawStr(),
  7466.                         MGL_getCharMetrics(), MGL_getFontMetrics()
  7467.  
  7468.  
  7469.             MGL_textWidth
  7470.  
  7471.             Function    Returns the width of the charcter string in
  7472.                         pixels
  7473.  
  7474.             Syntax      int MGL_textWidth(const char *str);
  7475.  
  7476.             Prototype   mgraph.h
  7477.             in
  7478.  
  7479.             Parameters  str - Character string to measure
  7480.  
  7481.             Remarks     MGL_textWidth() returns the width of the
  7482.                         specified character string using the
  7483.                         dimensions of the currently active font in
  7484.                         pixels. This includes any scaling
  7485.                         transformations that are applied to the font
  7486.                         and will be as accurate as possible at the
  7487.                         resolution of the display device.
  7488.  
  7489.             Return      Width of the character string in pixels
  7490.             value
  7491.  
  7492.             See also    MGL_textHeight(), MGL_drawStr(),
  7493.                         MGL_getCharMetrics(), MGL_getFontMetrics()
  7494.  
  7495.  
  7496.  
  7497.  
  7498.  
  7499.  
  7500.  
  7501.  
  7502.             Chapter 6 - Console Library                              111
  7503.  
  7504.  
  7505.  
  7506.  
  7507.  
  7508.  
  7509.             MGL_underScoreLocation
  7510.  
  7511.             Function    Returns the location to begin drawing an
  7512.                         underscore for the font.
  7513.  
  7514.             Syntax      void MGL_underScoreLocation(int *x, int *y,
  7515.                         const char *str)
  7516.  
  7517.             Prototype   mgraph.h
  7518.             in
  7519.  
  7520.             Parameters  x - X coordinate to be passed to
  7521.                         MGL_drawStrXY()
  7522.                         y - Y coordinate to be passed to
  7523.                         MGL_drawStrXY()
  7524.                         str - String to measure
  7525.  
  7526.             Remarks     MGL_underScoreLocation() takes an (x,y)
  7527.                         location that would normally be be used to
  7528.                         draw a string with MGL_drawStrXY(), and
  7529.                         adjusts the coordinates to begin at the under
  7530.                         score location for the current font, in the
  7531.                         current drawing attributes. Thus the entire
  7532.                         character string can be underlined by drawing
  7533.                         a line starting at the computed underscore
  7534.                         location and extending for MGL_textWidth()
  7535.                         pixels in length.
  7536.  
  7537.             See also    MGL_drawStrXY(), MGL_textWidth()
  7538.  
  7539.  
  7540.             MGL_unloadFont
  7541.  
  7542.             Function    Unloads the specified font from memory.
  7543.  
  7544.             Syntax      void MGL_unloadFont(font *font);
  7545.  
  7546.             Prototype   mgraph.h
  7547.             in
  7548.  
  7549.             Parameters  font - Pointer to loaded font file to unload.
  7550.  
  7551.             Remarks     MGL_unloadFont() attempts to unload the
  7552.                         specified font if the font is a valid font
  7553.                         that was loaded with the MGL_loadFont()
  7554.                         routine. The memory occupied by the font will
  7555.                         be released to the global heap.
  7556.  
  7557.             Return      True if font was unloaded, false if font was
  7558.             value       invalid.
  7559.  
  7560.             See also    MGL_loadFont()
  7561.  
  7562.  
  7563.  
  7564.  
  7565.  
  7566.  
  7567.  
  7568.  
  7569.             112                     MegaGraph Graphics Library Reference
  7570.  
  7571.  
  7572.  
  7573.  
  7574.  
  7575.  
  7576.             MGL_unpackColor
  7577.  
  7578.             Function    Unpacks a packed 24 bit color value into RGB
  7579.                         components.
  7580.  
  7581.             Syntax      void MGL_unpackColor(color_t color,uchar
  7582.                         *R,uchar *G,uchar *B);
  7583.  
  7584.             Prototype   mgraph.h
  7585.             in
  7586.  
  7587.             Parameters  color - Color value to unpack.
  7588.                         R - Place to store the red component
  7589.                         G - Place to store the green component
  7590.                         B - Place to store the blue component
  7591.  
  7592.             Remarks     MGL_unpackColor() takes a packed color value
  7593.                         in the correct format for the current color
  7594.                         mode, and extracts the red, green and blue
  7595.                         components. Note that the color values may
  7596.                         not be the same as when you packed them with
  7597.                         MGL_packColor() if the color mode is a 15 or
  7598.                         16 bit mode because of loss of precision. The
  7599.                         values are scaled back into the normal 24 bit
  7600.                         RGB space.
  7601.  
  7602.             See also    MGL_packColor(), MGL_getPixelFormat()
  7603.  
  7604.  
  7605.             MGL_packColor
  7606.  
  7607.             Function    Packs an RGB triple into the correct format
  7608.                         for current mode.
  7609.  
  7610.             Syntax      color_t MGL_packColor(uchar R, uchar G, uchar
  7611.                         B)
  7612.  
  7613.             Prototype   mgraph.h
  7614.             in
  7615.  
  7616.             Parameters  R - Red component of color
  7617.                         G - Green component of color
  7618.                         B - Blue component of color
  7619.  
  7620.             Remarks     MGL_packColor() takes a 24 bit RGB triple and
  7621.                         converts it to the correct pack pixel format
  7622.                         required by the current video mode. This
  7623.                         packed pixel color value can then be passed
  7624.                         to routines that require an MGL color_t color
  7625.                         value such as MGL_setColor() etc.
  7626.  
  7627.             Return      MGL pack pixel color value representing the
  7628.             value       specified color.
  7629.  
  7630.             See also    MGL_unpackColor(), MGL_getPixelFormat(),
  7631.                         MGL_setColor()
  7632.  
  7633.  
  7634.  
  7635.  
  7636.             Chapter 6 - Console Library                              113
  7637.  
  7638.  
  7639.  
  7640.  
  7641.  
  7642.  
  7643.             MGL_useFont
  7644.  
  7645.             Function    Sets the currently active font.
  7646.  
  7647.             Syntax      bool MGL_useFont(font *font)
  7648.  
  7649.             Prototype   mgraph.h
  7650.             in
  7651.  
  7652.             Parameters  font - New font to use.
  7653.  
  7654.             Remarks     MGL_useFont() selects the specified font as
  7655.                         the currently active font for use by the MGL.
  7656.                         If the font data is invalid, the MGL result
  7657.                         flag is set and the routine will return
  7658.                         false.
  7659.  
  7660.                         Note: Do not unload a font file if it is
  7661.                         currently in use by the MGL!
  7662.  
  7663.             Return      True if the font was valid and selected,
  7664.             value       false if not.
  7665.  
  7666.             See also    MGL_drawStr()
  7667.  
  7668.  
  7669.             MGL_vecFontEngine
  7670.  
  7671.             Function    Generates the commands to draw vector font.
  7672.  
  7673.             Syntax      bool MGL_vecFontEngine(int x, int y, const
  7674.                         char *str, void (*move)(int x,int y), void
  7675.                         (*draw)(int x,int y));
  7676.  
  7677.             Prototype   mgraph.h
  7678.             in
  7679.  
  7680.             Parameters  x,y - Coordinate to start drawing text at
  7681.                         str - Character string to draw
  7682.                         move - Routine to call to perform a move
  7683.                         operation
  7684.                         draw - Routine to call to perform a draw
  7685.                         operation
  7686.  
  7687.  
  7688.  
  7689.  
  7690.  
  7691.  
  7692.  
  7693.  
  7694.  
  7695.  
  7696.  
  7697.  
  7698.  
  7699.  
  7700.  
  7701.  
  7702.  
  7703.             114                     MegaGraph Graphics Library Reference
  7704.  
  7705.  
  7706.  
  7707.  
  7708.  
  7709.  
  7710.             Remarks     MGL_vecFontEngine() calls a set of user
  7711.                         supplied routines to render the characters in
  7712.                         a vector font. This allows the vector fonts
  7713.                         to be drawn in 2D or 3D floating point
  7714.                         coordinate systems by transforming each of
  7715.                         the operations needed to draw each character,
  7716.                         or in any coordinate system that the users
  7717.                         desires.
  7718.  
  7719.                             move
  7720.                         The      routine is called to move the cursor
  7721.                         to a new location, and the      routine is
  7722.                                                    draw
  7723.                         used to perform a draw operation from the
  7724.                         current location to the specified location.
  7725.                         Each character in the vector font is started
  7726.                         with a move operation.
  7727.  
  7728.                         Note that the coordinates passed to the move
  7729.                         and draw routines will be offset from the
  7730.                         point (x,y), where the point (x,y) is the
  7731.                         origin of the first character (ie: it lies on
  7732.                         its baseline). Note also that the coordinates
  7733.                         will be relative to the origin with the
  7734.                         origin at the lower left corner of each
  7735.                         character (ie: inverse of normal device
  7736.                         coordinate yaxis values).
  7737.  
  7738.                         This routine does not honor the standard
  7739.                         scaling factors, but simply draws the
  7740.                         characters at character size of (1,1,1,1)
  7741.                         (because scaling will be done by the user
  7742.                         supplied move and draw routines).
  7743.  
  7744.                         If the passed font is NOT a valid vector
  7745.                         font, this routine returns false.
  7746.  
  7747.             Return      True if string correctly rendered, false if
  7748.             value       font is not a vector font.
  7749.  
  7750.             See also    MGL_drawStr(), MGL_useFont()
  7751.  
  7752.  
  7753.             MGL_vSync
  7754.  
  7755.             Function    Waits for a vertical refresh signal.
  7756.  
  7757.             Syntax      void MGL_vSync(void);
  7758.  
  7759.             Prototype   mgraph.h
  7760.             in
  7761.  
  7762.             Remarks     MGL_vSync() waits for a vertical refresh
  7763.                         signal from the video display before
  7764.                         returning. This can be used to sync your
  7765.                         graphics output to the vertical sync pulse to
  7766.                         produce flicker free animation or to produce
  7767.                         animation that runs at a constant speed.
  7768.  
  7769.  
  7770.  
  7771.  
  7772.             Chapter 6 - Console Library                              115
  7773.  
  7774.  
  7775.  
  7776.  
  7777.  
  7778.  
  7779.             MS_obscure
  7780.  
  7781.             Function    Hides the mouse cursor from view during
  7782.                         graphics output.
  7783.  
  7784.             Syntax      void MS_obscure(void);
  7785.  
  7786.             Prototype   mgraph.h
  7787.             in
  7788.  
  7789.             Remarks     MS_obscure   hides the mouse cursor from view
  7790.                                   ()
  7791.                         in order to perform graphics output using the
  7792.                         MGL. If the graphics device driver supports a
  7793.                         hardware cursor, this is handled by the
  7794.                         hardware, otherwise it is removed from the
  7795.                         display. You should call this routine rather
  7796.                         than MS_hide() in order to temporarily hide
  7797.                         the cursor during graphics output as the
  7798.                         MS_hide() routine can produce incorrect
  7799.                         results if call in quick succession for
  7800.                         systems that support a hardware mouse cursor.
  7801.  
  7802.             See also    MS_unobscure()
  7803.  
  7804.  
  7805.             MS_unobscure
  7806.  
  7807.             Function    Restores the mouse cursor to view after
  7808.                         graphics output.
  7809.  
  7810.             Syntax      void MS_unobscure(void);
  7811.  
  7812.             Prototype   mgraph.h
  7813.             in
  7814.  
  7815.             Remarks     MS_unobscure() redisplays the cursor again
  7816.                         after screen output has finished.
  7817.  
  7818.             See also    MS_obscure()
  7819.  
  7820.  
  7821.  
  7822.  
  7823.  
  7824.  
  7825.  
  7826.  
  7827.  
  7828.  
  7829.  
  7830.  
  7831.  
  7832.  
  7833.  
  7834.  
  7835.  
  7836.  
  7837.  
  7838.  
  7839.  
  7840.             116                     MegaGraph Graphics Library Reference
  7841.  
  7842.  
  7843.  
  7844.  
  7845.  
  7846.  
  7847.  
  7848.  
  7849.  
  7850.                                                 C  O  N  T  E  N  T  S
  7851.  
  7852.  
  7853.  
  7854.             Chapter 1 - Introduction
  7855.             Chapter 1 - Introduction
  7856.             Chapter 1 - Introduction ................................
  7857.                                      ................................
  7858.                                      ................................1
  7859.                                                                      1
  7860.                                                                      1
  7861.  
  7862.             Chapter 2 - Library reference
  7863.             Chapter 2 - Library reference
  7864.             Chapter 2 - Library reference ...........................
  7865.                                           ...........................
  7866.                                           ...........................3
  7867.                                                                      3
  7868.                                                                      3
  7869.                  How to use reference entries .......................4
  7870.                  MGL_availableFont ..................................5
  7871.                  MGL_availableModes .................................5
  7872.                  MGL_availablePages .................................6
  7873.                  MGL_beginDrawing ...................................6
  7874.                  MGL_beginGouraud ...................................7
  7875.                  MGL_beginPixel .....................................8
  7876.                  MGL_charWidth ......................................8
  7877.                  MGL_clearDevice ....................................8
  7878.                  MGL_clearViewport ..................................9
  7879.                  MGL_clipLine .......................................9
  7880.                  MGL_copyImage .....................................10
  7881.                  MGL_copyImageCoord ................................10
  7882.                  MGL_defaultAttributes .............................11
  7883.                  MGL_defaultColor ..................................11
  7884.                  MGL_detectGraph ...................................12
  7885.                  MGL_disjointRect ..................................13
  7886.                  MGL_divotSize .....................................13
  7887.                  MGL_divotSizeCoord ................................14
  7888.                  MGL_doubleBuffer ..................................14
  7889.                  MGL_drawBorder ....................................15
  7890.                  MGL_drawBorderCoord ...............................16
  7891.                  MGL_drawHDivider ..................................17
  7892.                  MGL_drawStr .......................................17
  7893.                  MGL_drawStrXY .....................................18
  7894.                  MGL_drawVDivider ..................................18
  7895.                  MGL_driverName ....................................19
  7896.                  MGL_ellipse .......................................19
  7897.                  MGL_ellipseArc ....................................20
  7898.                  MGL_ellipseArcCoord ...............................21
  7899.                  MGL_ellipseCoord ..................................22
  7900.                  MGL_ellipseEngine .................................22
  7901.                  MGL_emptyRect .....................................23
  7902.                  MGL_endDrawing ....................................24
  7903.                  MGL_endGouraud ....................................24
  7904.                  MGL_endPixel ......................................25
  7905.                  MGL_equalPoint ....................................25
  7906.                  MGL_equalRect .....................................25
  7907.                  MGL_errorMsg ......................................26
  7908.                  MGL_exit ..........................................26
  7909.                  MGL_fadePalette ...................................27
  7910.                  MGL_fillEllipse ...................................28
  7911.                  MGL_fillEllipseArc ................................28
  7912.                  MGL_fillEllipseArcCoord ...........................29
  7913.                  MGL_fillEllipseCoord ..............................30
  7914.                  MGL_fillGouraudPolygon ............................31
  7915.                  MGL_fillPolygon ...................................32
  7916.                  MGL_fillPolygonFast ...............................33
  7917.  
  7918.  
  7919.             Contents                                                   i
  7920.  
  7921.  
  7922.  
  7923.  
  7924.  
  7925.  
  7926.                  MGL_fillRect ......................................34
  7927.                  MGL_fillRectCoord .................................34
  7928.                  MGL_fillRectPt ....................................35
  7929.                  MGL_getActivePage .................................35
  7930.                  MGL_getArcCoords ..................................36
  7931.                  MGL_getAspectRatio ................................36
  7932.                  MGL_getAttributes .................................37
  7933.                  MGL_getBackColor ..................................38
  7934.                  MGL_getBorderColors ...............................39
  7935.                  MGL_getCharMetrics ................................39
  7936.                  MGL_getClipMode ...................................40
  7937.                  MGL_getClipRect ...................................41
  7938.                  MGL_getColor ......................................41
  7939.                  MGL_getCP .........................................41
  7940.                  MGL_getCursorColor ................................42
  7941.                  MGL_getDefaultPalette .............................42
  7942.                  MGL_getDivot ......................................43
  7943.                  MGL_getDivotCoord .................................44
  7944.                  MGL_getDriver .....................................44
  7945.                  MGL_getFont .......................................45
  7946.                  MGL_getFontMetrics ................................45
  7947.                  MGL_getImage ......................................46
  7948.                  MGL_getImageCoord .................................47
  7949.                  MGL_getMarkerColor ................................48
  7950.                  MGL_getMarkerSize .................................48
  7951.                  MGL_getMarkerStyle ................................48
  7952.                  MGL_getMode .......................................49
  7953.                  MGL_getPalette ....................................49
  7954.                  MGL_getPaletteEntry ...............................50
  7955.                  MGL_getPaletteSize ................................51
  7956.                  MGL_getPaletteSnowLevel ...........................51
  7957.                  MGL_getPenBitmapPattern ...........................51
  7958.                  MGL_getPenSize ....................................52
  7959.                  MGL_getPenStyle ...................................52
  7960.                  MGL_getPixel ......................................53
  7961.                  MGL_getPixelCoord .................................54
  7962.                  MGL_getPixelFormat ................................54
  7963.                  MGL_getPolygonType ................................56
  7964.                  MGL_getSpaceExtra .................................56
  7965.                  MGL_getTextDirection ..............................57
  7966.                  MGL_getTextJustify ................................57
  7967.                  MGL_getTextSettings ...............................58
  7968.                  MGL_getTextSize ...................................59
  7969.                  MGL_getViewport ...................................60
  7970.                  MGL_getVisualPage .................................60
  7971.                  MGL_getWriteMode ..................................61
  7972.                  MGL_getX ..........................................61
  7973.                  MGL_getY ..........................................62
  7974.                  MGL_globalToLocal .................................62
  7975.                  MGL_gouraudScanLine ...............................63
  7976.                  MGL_imageSize .....................................63
  7977.                  MGL_imageSizeCoord ................................64
  7978.                  MGL_init ..........................................65
  7979.                  MGL_insetRect .....................................66
  7980.                  MGL_line ..........................................66
  7981.                  MGL_lineCoord .....................................67
  7982.                  MGL_lineCoordFast .................................67
  7983.                  MGL_lineEngine ....................................68
  7984.  
  7985.  
  7986.             ii                                                  Contents
  7987.  
  7988.  
  7989.  
  7990.  
  7991.  
  7992.  
  7993.                  MGL_lineFast ......................................68
  7994.                  MGL_lineRel .......................................69
  7995.                  MGL_lineRelCoord ..................................69
  7996.                  MGL_lineTo ........................................70
  7997.                  MGL_lineToCoord ...................................70
  7998.                  MGL_loadFont ......................................71
  7999.                  MGL_localToGlobal .................................71
  8000.                  MGL_marker ........................................72
  8001.                  MGL_maxCharWidth ..................................72
  8002.                  MGL_maxColor ......................................72
  8003.                  MGL_maxPage .......................................73
  8004.                  MGL_maxx ..........................................73
  8005.                  MGL_maxy ..........................................74
  8006.                  MGL_modeName ......................................74
  8007.                  MGL_moveRel .......................................74
  8008.                  MGL_moveRelCoord ..................................75
  8009.                  MGL_moveTo ........................................75
  8010.                  MGL_moveToCoord ...................................76
  8011.                  MGL_offsetRect ....................................76
  8012.                  MGL_packColor .....................................76
  8013.                  MGL_pixel .........................................77
  8014.                  MGL_pixelCoord ....................................77
  8015.                  MGL_polyLine ......................................78
  8016.                  MGL_polyMarker ....................................78
  8017.                  MGL_polyPoint .....................................79
  8018.                  MGL_popViewport ...................................79
  8019.                  MGL_ptInRect ......................................79
  8020.                  MGL_ptInRectCoord .................................80
  8021.                  MGL_pushViewport ..................................80
  8022.                  MGL_putDivot ......................................80
  8023.                  MGL_putIcon .......................................81
  8024.                  MGL_putImage ......................................81
  8025.                  MGL_putImageCoord .................................82
  8026.                  MGL_putMonoImage ..................................83
  8027.                  MGL_realColor .....................................83
  8028.                  MGL_rect ..........................................84
  8029.                  MGL_rectCoord .....................................84
  8030.                  MGL_rectPt ........................................85
  8031.                  MGL_registerDriver ................................85
  8032.                  MGL_restoreAttributes .............................86
  8033.                  MGL_restoreCRTMode ................................86
  8034.                  MGL_result ........................................86
  8035.                  MGL_rotatePalette .................................87
  8036.                  MGL_scanLeftForColor ..............................88
  8037.                  MGL_scanLeftWhileColor ............................89
  8038.                  MGL_scanLine ......................................90
  8039.                  MGL_scanRightForColor .............................91
  8040.                  MGL_scanRightWhileColor ...........................91
  8041.                  MGL_setActivePage .................................92
  8042.                  MGL_setAspectRatio ................................93
  8043.                  MGL_setBackColor ..................................93
  8044.                  MGL_setBorderColors ...............................94
  8045.                  MGL_setBufSize ....................................95
  8046.                  MGL_setClipMode ...................................95
  8047.                  MGL_setClipRect ...................................96
  8048.                  MGL_setColor ......................................96
  8049.                  MGL_setCursorColor ................................97
  8050.                  MGL_setDefaultPalette .............................97
  8051.  
  8052.  
  8053.             Contents                                                 iii
  8054.  
  8055.  
  8056.  
  8057.  
  8058.  
  8059.  
  8060.                  MGL_setGraphMode ..................................97
  8061.                  MGL_setMarkerColor ................................98
  8062.                  MGL_setMarkerSize .................................98
  8063.                  MGL_setMarkerStyle ................................99
  8064.                  MGL_setPalette ....................................99
  8065.                  MGL_setPaletteEntry ..............................100
  8066.                  MGL_setPaletteSnowLevel ..........................101
  8067.                  MGL_setPenBitmapPattern ..........................101
  8068.                  MGL_setPenSize ...................................102
  8069.                  MGL_setPenStyle ..................................102
  8070.                  MGL_setPolygonType ...............................103
  8071.                  MGL_setRelViewport ...............................103
  8072.                  MGL_setResult ....................................104
  8073.                  MGL_setSpaceExtra ................................104
  8074.                  MGL_setTextDirection .............................105
  8075.                  MGL_setTextJustify ...............................105
  8076.                  MGL_setTextSettings ..............................106
  8077.                  MGL_setTextSize ..................................107
  8078.                  MGL_setViewport ..................................108
  8079.                  MGL_setVisualPage ................................108
  8080.                  MGL_setWriteMode .................................109
  8081.                  MGL_singleBuffer .................................109
  8082.                  MGL_sizex ........................................109
  8083.                  MGL_sizey ........................................110
  8084.                  MGL_swapBuffers ..................................110
  8085.                  MGL_textHeight ...................................111
  8086.                  MGL_textWidth ....................................111
  8087.                  MGL_underScoreLocation ...........................112
  8088.                  MGL_unloadFont ...................................112
  8089.                  MGL_unpackColor ..................................113
  8090.                  MGL_packColor ....................................113
  8091.                  MGL_useFont ......................................114
  8092.                  MGL_vecFontEngine ................................114
  8093.                  MGL_vSync ........................................115
  8094.                  MS_obscure .......................................116
  8095.                  MS_unobscure .....................................116
  8096.  
  8097.  
  8098.  
  8099.  
  8100.  
  8101.  
  8102.  
  8103.  
  8104.  
  8105.  
  8106.  
  8107.  
  8108.  
  8109.  
  8110.  
  8111.  
  8112.  
  8113.  
  8114.  
  8115.  
  8116.  
  8117.  
  8118.  
  8119.  
  8120.             iv                                                  Contents
  8121.  
  8122.  
  8123.  
  8124.  
  8125.  
  8126.  
  8127.  
  8128.  
  8129.  
  8130.  
  8131.  
  8132.  
  8133.  
  8134.  
  8135.  
  8136.  
  8137.  
  8138.  
  8139.  
  8140.  
  8141.  
  8142.  
  8143.  
  8144.  
  8145.  
  8146.  
  8147.  
  8148.  
  8149.                             MegaGraph Graphics Library
  8150.                              Library Reference Manual
  8151.  
  8152.  
  8153.  
  8154.  
  8155.                        Copyright (C) 1993 SciTech Software.
  8156.                                All Rights Reserved.
  8157.  
  8158.  
  8159.                                    Version 1.0
  8160.                                 December 30, 1993
  8161.